home *** CD-ROM | disk | FTP | other *** search
/ Shareware Super Platinum 8 / Shareware Super Platinum 8.iso / mac / DATABASE / EB12.ZIP;1 / PACKED.EB / REFER.REP < prev   
Encoding:
Text File  |  1994-02-25  |  183.1 KB  |  7,993 lines

  1.  
  2.  
  3.  
  4.        ÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕ
  5.                    EASY BASE PROGRAMMERS REFERENCE
  6.                                Contents
  7.        ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ
  8.  
  9.                    Procedure Commands            Page
  10.                    ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ
  11.  
  12.                    Clear Records From             13
  13.                    Copy All From                  18
  14.                    Create Temp As                 20
  15.                    Declare                        28
  16.                    Delay                          31
  17.                    Delete Record                  33
  18.                    Derive Off                     34
  19.                    Display Status                 35
  20.                    Do..Loop                       36
  21.                    Escape On/Off                  38
  22.                    Exit Batch Menu                39
  23.                    Exit Procedure                 40
  24.                    For..Next                      43
  25.                    If Then Else                   56
  26.                    Index Off                      58
  27.                    List Variables                 68
  28.                    Multiple Lines                 82
  29.                    Odd/Even Page Print            83
  30.                    Pause On/Off                   93
  31.                    Preselect                      95
  32.                    Print                          96
  33.                    Printer Control                97
  34.                    Remark                        103
  35.                    Skip Group                    115
  36.                    Skip Record                   116
  37.                    Subindex                      122
  38.                    Update Record                 133
  39.  
  40.  
  41.                    System Values                 Page
  42.                    ƒƒƒƒƒƒƒƒƒƒƒƒƒ
  43.  
  44.                    Blank.                          7
  45.                    Bottom Margin                   8
  46.                    Current Record                 22
  47.                    Global Number                  52
  48.                    Output                         90
  49.                    Page Number                    92
  50.                    Pi                             94
  51.                    Record Number                 102
  52.                    Sequence                      113
  53.                    System Date                   124
  54.                    System Time                   125
  55.                    Total Copies                  131
  56.                    Total Records                 132
  57. ................................................................................
  58.  
  59.  
  60.                    Functions                     Page
  61.                    ƒƒƒƒƒƒƒƒƒ
  62.  
  63.                    Abs                             1
  64.                    Chr$                           12
  65.                    Datetext                       24
  66.                    Dayofmonth                     25
  67.                    Dayofweek                      26
  68.                    Dayofyear                      27
  69.                    Default                        29
  70.                    Hours                          54
  71.                    If                             55
  72.                    Intext                         63
  73.                    Jointext                       64
  74.                    Lefttext                       65
  75.                    Lengthtext                     66
  76.                    Lookup                         69
  77.                    Lower                          70
  78.                    Makedate                       71
  79.                    Maketime                       72
  80.                    Maths                          73
  81.                    Midtext                        77
  82.                    Minutes                        78
  83.                    Mod                            79
  84.                    Month                          80
  85.                    Proper                         98
  86.                    Random                        100
  87.                    Retail                        105
  88.                    Reverse                       107
  89.                    Righttext                     108
  90.                    Round                         109
  91.                    Seconds                       112
  92.                    Spacepad                      117
  93.                    Spellday                      118
  94.                    Spellmonth                    119
  95.                    Stringof                      121
  96.                    Timeampm                      130
  97.                    Upper                         134
  98.                    V.A.T. Functions              135
  99.                    Year                          136
  100.                    Zeropad                       137
  101.  
  102.  
  103.                    Field Controls                Page
  104.                    ƒƒƒƒƒƒƒƒƒƒƒƒƒƒ
  105.  
  106.                    Beep                            6
  107.                    Clearfields                    14
  108.                    Delay                          30
  109.                    Run                           110
  110. ................................................................................
  111.  
  112.  
  113.                    Field Types                   Page
  114.                    ƒƒƒƒƒƒƒƒƒƒƒ
  115.  
  116.                    Choice                         11
  117.                    Date                           23
  118.                    Fixed Point                    41
  119.                    Floating Point                 42
  120.                    Formatted Text                 51
  121.                    Integer                        62
  122.                    Text                          127
  123.                    Text Block                    128
  124.                    Time                          129
  125.  
  126.  
  127.                    Field Derivation Prefixes     Page
  128.                    ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ
  129.  
  130.                    Current                        21
  131.                    Goto (Field) Next              53
  132.                    Retest                        106
  133.                    Start Here                    120
  134.  
  135.  
  136.                    Utilities                     Page
  137.                    ƒƒƒƒƒƒƒƒƒ
  138.  
  139.                    Alter Vat Rates                 4
  140.                    Backup Application              5
  141.                    Change Password                10
  142.                    Delete Choice Lists            32
  143.                    Install Form                   59
  144.                    Install Printer                60
  145.                    Install Procedure              61
  146.                    List File Names                67
  147.                    Options                        89
  148.                    Pack Data Forms                91
  149.                    Rebuild Directories           101
  150.                    Restore                       104
  151.                    Screen Colours                111
  152.                    Set Paper Length              114
  153.  
  154.  
  155.                    User Menu Functions           Page
  156.                    ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ
  157.  
  158.                    Menu Calls                     76
  159.  
  160.  
  161.                    Operators                     Page
  162.                    ƒƒƒƒƒƒƒƒƒ
  163.  
  164.                    Arithmetic                     86
  165.                    Logical                        88
  166.                    Relational                     87
  167. ................................................................................
  168.  
  169.  
  170.                    Methods                       Page
  171.                    ƒƒƒƒƒƒƒ
  172.  
  173.                    Address Labels                  2
  174.                    Bypass Sign-on Sreen            9
  175.                    Compound Index                 15
  176.                    Correcting Stats.              19
  177.                    Duplicate Prevention           37
  178.                    Form Letters                   49
  179.                    Maximizing Speed               74
  180.                    Multiple Columns               81
  181.                    Q And A Input Screen           99
  182.                    Tabulation                    126
  183. ................................................................................
  184.        ABS                  ˇˇˇˇˇˇFUNCTION        ˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇABS
  185.  
  186.        This function returns the absolute (positive) value of a
  187.        number.
  188.  
  189.        Ex. abs(length - breadth)
  190.           This returns 6 if length = 12 and breadth = 6
  191.           or if length = 6 and breadth = 12
  192.  
  193.  
  194.        Acceptable parameters
  195.  
  196.        Numeric value
  197.        Numeric expression
  198.        Numeric field/variable
  199.        Any function which returns a numeric value
  200.  
  201.  
  202.  
  203.  
  204.  
  205.  
  206.  
  207.  
  208.  
  209.  
  210.  
  211.  
  212.  
  213.  
  214.  
  215.  
  216.  
  217.  
  218.  
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.                                  - 1 -
  240. ................................................................................
  241.        ADDRESS LABELS       ˇˇˇˇˇˇˇMETHOD         ˇˇˇˇˇˇADDRESS LABELS
  242.  
  243.        Although printing address labels from a data form is quite
  244.        straight forward it may not be obvious to a beginner how to
  245.        output data in more than one column. The following procedure
  246.        prints two columns of address labels from a "Addr" form.
  247.  
  248.        Declare output fields
  249.           Addr.name : Addr.street : Addr.town : Addr.pcode
  250.           Lname : Lstreet : Ltown : Lpcode
  251.        end
  252.        for Addr
  253.           if Lname = blank then
  254.              Lname = Addr.name : Lstreet = Addrstreet
  255.              Ltown = Addr.town : Lpcode = Addrpcode
  256.           else
  257.              print list items
  258.              Lname = blank : Lstreet = blank
  259.              Ltown = Blank : Lpcode  = blank
  260.           end if
  261.        next
  262.        if Lname <> blank then print list items
  263.  
  264.        ....................Output Format........................
  265.  
  266.        .List Items
  267.  
  268.             {Lname field        }       {Addr.name field    }
  269.             {Lstreet field      }       {Addr.street field  }
  270.             {Ltown field        }       {Addr.town field    }
  271.             {Lpcode field       }       {Addr.pcode field   }
  272.  
  273.        .end
  274.  
  275.  
  276.        The field positioning and the distance between the .List Items
  277.        and .end can be adjusted to fit the label paper.
  278.  
  279.  
  280.        If your label paper has three columns then you could use the
  281.        following procedure.
  282.  
  283.        declare output fields
  284.           Addr.name : Addr.street : Addr.town : Addr.pcode
  285.           Mname : Mstreet : Mtown : Mpcode
  286.           Lname : Lstreet : Ltown : Lpcode
  287.        end
  288.        declare variables
  289.           x as number
  290.        end
  291.  
  292.        Continued.
  293.  
  294.  
  295.  
  296.                                  - 2 -
  297. ................................................................................
  298.        ADDRESS LABELS       ˇˇˇˇˇˇˇMETHOD         ˇˇˇˇˇˇADDRESS LABELS
  299.  
  300.        for addr
  301.           x = x + 1
  302.           if Mod(x,3) = 1 then
  303.              Lname = Addr.name : Lstreet = Addr.street
  304.              Ltown = Addr.town : Lpcode = Addr.pcode
  305.           end if
  306.           if Mod(x,3) = 2 then
  307.              Mname = Addr.name : Mstreet = Addr.street
  308.              Mtown = Addr.town : Mpcode = Addr.pcode
  309.           end if
  310.           if Mod(x,3) = 0 then
  311.              Print list items
  312.              Lname = Blank : Lstreet = blank
  313.              Ltown = blank : Lpcode = Blank
  314.              Mname = Blank : Mstreet = blank
  315.              Mtown = blank : Mpcode = Blank
  316.           end if
  317.        next
  318.        If Lname <> blank then print list items
  319.  
  320.  
  321.        .........................output format...................
  322.  
  323.  
  324.        .list items
  325.  
  326.           { Lname       }    { Mname       }   { Addr.name   }
  327.           { Lstreet     }    { Mstreet     }   { Addr.street }
  328.           { Ltown       }    { Mtown       }   { Addr.town   }
  329.           { Lpcode      }    { Mpcode      }   { Addr.pcode  }
  330.  
  331.        .end
  332.  
  333.  
  334.  
  335.        See Also:- Form Letters
  336.  
  337.  
  338.  
  339.  
  340.  
  341.  
  342.  
  343.  
  344.  
  345.  
  346.  
  347.  
  348.  
  349.  
  350.  
  351.  
  352.  
  353.                                  - 3 -
  354. ................................................................................
  355.        ALTER VAT RATES      ˇˇˇˇˇˇUTILITY         ˇˇˇˇˇALTER VAT RATES
  356.  
  357.        The five VAT rates used by the VAT functions can be altered
  358.        either from the utilities menu or from a user menu function.
  359.        Just select "Alter VAT rates" - edit the percentages and press
  360.        F2 to save the new values.
  361.  
  362.  
  363.  
  364.  
  365.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402.  
  403.  
  404.  
  405.  
  406.  
  407.  
  408.  
  409.  
  410.                                  - 4 -
  411. ................................................................................
  412.        BACKUP APPLICATION   ˇˇˇˇˇˇUTILITY         ˇˇBACKUP APPLICATION
  413.  
  414.        Easy Base includes an inbuilt Backup system for your
  415.        applications and data.
  416.  
  417.        If you select "Backup Application" from the utilities menu then
  418.        Easy Base will backup your entire application - Choicelist
  419.        fields - Forms - Data and procedures. The backup system will
  420.        split large files across multiple disks automatically.
  421.  
  422.        When an application is finished and you have backup copies then
  423.        backing up choice lists and procedures is wasteful of time and
  424.        floppies. You can backup only the users data by calling "Backup
  425.        Data" from a user menu.
  426.  
  427.        Backup Principles.
  428.  
  429.        The reason for a backup is that in the event of a computer or
  430.        hard disk failure you will have your application or data to
  431.        restore on the new machine.
  432.  
  433.  
  434.        If you have no backup and your machine fails then you have lost
  435.        all your data. If you have only one backup and your machine
  436.        fails while doing a backup then you have lost all your data.
  437.  
  438.        The principle of safe backing up is to keep two sets of backup
  439.        disks in separate boxes marked "Latest" and "Previous".
  440.        Whenever you do a backup you use the disks from the "Previous"
  441.        box - move the disks from the "Latest" to the "Previous" and
  442.        put your new backups in the latest box when completed.
  443.  
  444.        This not only overcomes the problem of a failure during backup
  445.        but also provides a secondary set of disks if any of the
  446.        "Latest" disks turn out to be faulty when you come to restore.
  447.  
  448.        If you ever have to use a backup disk and find that it has
  449.        developed a bad sector then you can attempt a recovery with a
  450.        utility such as "Norton" Disk Test. Easy Base leaves
  451.        approximately 5K of unused disk space on all backup disks so
  452.        that such a utility has somewhere to move bad sectors to.
  453.  
  454.        To save disk space, Easy Base does not backup index files. If
  455.        you ever have to use a backup disk then the index files are
  456.        rebuilt after restoring the data.
  457.  
  458.  
  459.        See Also:-  Restore
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.  
  467.                                  - 5 -
  468. ................................................................................
  469.        BEEP                 ˇˇˇˇFIELD CONTROL     ˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇBEEP
  470.  
  471.        The "beep" control is used in field derivations to alert the
  472.        user to input errors. In addition to sounding the beeper the
  473.        "beep" control has two optional additional parts - A message to
  474.        be sent to the message line and cursor redirection. This is
  475.        normally to the field in which the error has been made but can
  476.        be to any field.  Field controls are appended to field
  477.        derivations and are enclosed in square brackets.
  478.  
  479.        Ex.  If(partno < 0,blank[beepPart Numbers must not be
  480.        negativeCursor partno],partno)
  481.  
  482.        In this example, if the user enters a negative number in the
  483.        partno field the computer will beep,the number will be cleared
  484.        from the field, the message "Part Numbers must not be negative"
  485.        will be displayed on the message line and the cursor will
  486.        return to the "partno" field.
  487.  
  488.        Ex. If(paid = "no" and chequeno <> blank,paid[beepEither bill
  489.        has been paid or cheque number entered in errorCursor
  490.        paid],paid)
  491.  
  492.        In Easy Base, division by zero is not trapped as an error.
  493.        There is a very good reason for this.  When you start a new
  494.        record and all the fields are blank then any field which
  495.        provides a value for a division in another field would cause a
  496.        division by zero error before its value had been entered.
  497.  
  498.        Whenever Easy Base encounters a division by Zero it divides by
  499.        one instead.  This is perfectly acceptable in most business
  500.        applications.  However, if you need to be warned of a division
  501.        by zero in formulae then you can provide your own error trap
  502.        using the "Beep" control.
  503.  
  504.        Ex.
  505.  
  506.           If( T4 = 0,blank[beepDivision by Zero Value from Field T4],
  507.                        T4)
  508.  
  509.  
  510.  
  511.  
  512.  
  513.  
  514.  
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.  
  524.                                  - 6 -
  525. ................................................................................
  526.        BLANK.               ˇˇˇˇSYSTEM VALUE      ˇˇˇˇˇˇˇˇˇˇˇˇˇˇBLANK.
  527.  
  528.        In Easy Base the value of any field which does not contain
  529.        characters is represented by the word "Blank" irrelevant of
  530.        data type.
  531.  
  532.        A numeric field returns the value "Blank" only when the field
  533.        is empty. If it has a value of zero then it is NOT blank.  In
  534.        fact, the main advantage of recognizing "Blank" is that you can
  535.        distinguish between zero value and empty numeric fields.
  536.  
  537.        There is, however, one slight disadvantage.  If a text field
  538.        contains ONLY the word blank and you use its value in a
  539.        derivation then the word "Blank" from the field will disappear.
  540.  
  541.        The "Name" field at the top left hand side of this page is
  542.        derived by the formula Upper(Name).  You will notice that
  543.        "Blank" is followed by a full stop.  If it were not then the
  544.        upper function would return "                    ".
  545.  
  546.        You can also remove a fields contents by setting it equal to
  547.        blank.
  548.  
  549.  
  550.  
  551.  
  552.  
  553.  
  554.  
  555.  
  556.  
  557.  
  558.  
  559.  
  560.  
  561.  
  562.  
  563.  
  564.  
  565.  
  566.  
  567.  
  568.  
  569.  
  570.  
  571.  
  572.  
  573.  
  574.  
  575.  
  576.  
  577.  
  578.  
  579.  
  580.  
  581.                                  - 7 -
  582. ................................................................................
  583.        BOTTOM MARGIN        ˇˇˇˇSYSTEM VALUE      ˇˇˇˇˇˇˇBOTTOM MARGIN
  584.  
  585.        Throughout a procedure which has a printed output, Easy base
  586.        keeps track of the length of page remaining (in inches) in the
  587.        system value "Bottom Margin". The Bottom margin value is used
  588.        to control pagination in procedures which "Report" on data.
  589.  
  590.        The "Bottom Margin" value is based on the paper type entered
  591.        from the Utilities Menu. You must set the type of paper you are
  592.        using before using "Bottom Margin".
  593.  
  594.        Ex.
  595.        Line feed: Line feed: Line feed
  596.        For employees
  597.           print list items
  598.           if bottom margin < .5 then
  599.              page feed: line feed :line feed : line feed
  600.           else
  601.              line feed
  602.           end if
  603.        next
  604.  
  605.        In the above example the list items section is printed with a
  606.        blank line between each and with a half inch top and bottom
  607.        page margin.
  608.  
  609.        When you base decisions on the "Bottom margin" value you should
  610.        always do so with a "Greater Than" or "Less Than" operator. If
  611.        you used " If Bottom margin = .5 then Page feed" your page
  612.        would only be ejected if and when the "Bottom Margin" value was
  613.        exactly 0.5  As most printing is done at six lines to the inch
  614.        it is most unlikely that the "Bottom margin" value would ever
  615.        be half an inch.
  616.  
  617.  
  618.  
  619.  
  620.  
  621.  
  622.  
  623.  
  624.  
  625.  
  626.  
  627.  
  628.  
  629.  
  630.  
  631.  
  632.  
  633.  
  634.  
  635.  
  636.  
  637.  
  638.                                  - 8 -
  639. ................................................................................
  640.        BYPASS SIGN-ON SREEN ˇˇˇˇˇˇˇMETHOD         BYPASS SIGN-ON SREEN
  641.  
  642.        You can bypass the sign-on screen for both the developers
  643.        password and any User-menu password by adding the password to
  644.        the start up command line. This is particularly useful in
  645.        finished applications as the application can be called directly
  646.        from a hard disk menu system - the sign on screen will not
  647.        appear and the application will start as if it were a stand
  648.        alone program.
  649.  
  650.        You can use either:-
  651.  
  652.           EB/password  or
  653.           EB password
  654.  
  655.        as your command line to bypass the sign on screen.
  656.  
  657.        If you do not have a hard disk menu system there is one
  658.        supplied free with the registered version of Easy Base.
  659.  
  660.  
  661.  
  662.  
  663.  
  664.  
  665.  
  666.  
  667.  
  668.  
  669.  
  670.  
  671.  
  672.  
  673.  
  674.  
  675.  
  676.  
  677.  
  678.  
  679.  
  680.  
  681.  
  682.  
  683.  
  684.  
  685.  
  686.  
  687.  
  688.  
  689.  
  690.  
  691.  
  692.  
  693.  
  694.  
  695.                                  - 9 -
  696. ................................................................................
  697.        CHANGE PASSWORD      ˇˇˇˇˇˇUTILITY         ˇˇˇˇˇCHANGE PASSWORD
  698.  
  699.        You can change your developers access password with this item
  700.        on the utilities menu.
  701.  
  702.  
  703.  
  704.  
  705.  
  706.  
  707.  
  708.  
  709.  
  710.  
  711.  
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.  
  719.  
  720.  
  721.  
  722.  
  723.  
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730.  
  731.  
  732.  
  733.  
  734.  
  735.  
  736.  
  737.  
  738.  
  739.  
  740.  
  741.  
  742.  
  743.  
  744.  
  745.  
  746.  
  747.  
  748.  
  749.  
  750.  
  751.  
  752.                                  - 10 -
  753. ................................................................................
  754.        CHOICE               ˇˇˇˇˇFIELD TYPE       ˇˇˇˇˇˇˇˇˇˇˇˇˇˇCHOICE
  755.  
  756.        If you define a field as the "Choice" type a window will open
  757.        into which you can type up to seventeen different choices.
  758.        When you have entered your choices you will be asked to give a
  759.        name to your choice list. Once a choice list has been saved it
  760.        can be used in any other choice field in any other form or
  761.        input screen.
  762.  
  763.        Once a choice list has been saved you can edit the contents but
  764.        not the field length. Editing a choice list in one form
  765.        automatically edits it for any other form.
  766.  
  767.        If you need to alter a list such that the field length will
  768.        change then you must create a new list. You can erase the old
  769.        one from the utilities menu.  If the list is used in more than
  770.        one form then you must redefine it in all the other forms in
  771.        which it is used
  772.  
  773.        When the cursor enters a choice field your choice list will be
  774.        displayed for the user to choose from. He cannot enter any
  775.        value other than one from the list.
  776.  
  777.  
  778.  
  779.  
  780.  
  781.  
  782.  
  783.  
  784.  
  785.  
  786.  
  787.  
  788.  
  789.  
  790.  
  791.  
  792.  
  793.  
  794.  
  795.  
  796.  
  797.  
  798.  
  799.  
  800.  
  801.  
  802.  
  803.  
  804.  
  805.  
  806.  
  807.  
  808.  
  809.                                  - 11 -
  810. ................................................................................
  811.        CHR$                 ˇˇˇˇˇˇFUNCTION        ˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇCHR$
  812.  
  813.        The Chr$ function returns the character whose ASCII number is
  814.        supplied as the parameter.
  815.  
  816.        Ex.   Chr$(171)
  817.              < Returns "´">
  818.  
  819.        Ex.   Jointext(Chr$(227),"r",Chr$(253))
  820.              < Returns "„r˝"
  821.  
  822.        In Easy Base, text fields are automatically justified left.
  823.        This is desirable in record entry as it prevents the user from
  824.        entering leading spaces in indexed fields and consequently
  825.        trashing alphabetic printouts. However, you may wish to right
  826.        justify or centre justify text in printouts. For example, the
  827.        righthand "Chr$" at the top of this page is right justified in
  828.        its field. You can use the ASCII character 255 to achieve right
  829.        or centre justification.
  830.  
  831.        Ex.
  832.  
  833.        Heading = jointext(stringof((30-lengthtext(name))/2,Chr$(255)),
  834.        name)
  835.            < This centres name in the 30 character field "heading">
  836.  
  837.        Ex.
  838.  
  839.        Heading =Jointext(stringof(40-lengthtext(name),Chr$(255)),name)
  840.  
  841.           < This right justifies name in a 40 character field
  842.             "Heading">
  843.  
  844.  
  845.        CAUTION:
  846.  
  847.        You can produce any ASCII character ( 0 - 255 ) with the Chr$
  848.        function. ASCII characters 0 to 31 are used as printer controls
  849.        and although you can use them freely on screen you should never
  850.        include them in a procedure output which will be sent to the
  851.        printer.
  852.  
  853.        Acceptable parameters:
  854.  
  855.        Numeric value, field, variable, expression or function
  856.        returning a number between 0 and 255
  857.  
  858.  
  859.  
  860.  
  861.  
  862.  
  863.  
  864.  
  865.  
  866.                                  - 12 -
  867. ................................................................................
  868.        CLEAR RECORDS FROM   ˇˇPROCEDURE COMMAND   ˇˇCLEAR RECORDS FROM
  869.  
  870.        The "Clear Records From" command clears all records from a form
  871.        by erasing its data and index files. If you need to erase all
  872.        records form a form always use the "Clear Records" command
  873.        rather than "Delete Record" command. It is much faster and does
  874.        not require the form to be re-packed afterward.
  875.  
  876.        Ex.
  877.  
  878.        If input.confirm = "yes" then clear records from invoices
  879.  
  880.  
  881.  
  882.  
  883.  
  884.  
  885.  
  886.  
  887.  
  888.  
  889.  
  890.  
  891.  
  892.  
  893.  
  894.  
  895.  
  896.  
  897.  
  898.  
  899.  
  900.  
  901.  
  902.  
  903.  
  904.  
  905.  
  906.  
  907.  
  908.  
  909.  
  910.  
  911.  
  912.  
  913.  
  914.  
  915.  
  916.  
  917.  
  918.  
  919.  
  920.  
  921.  
  922.  
  923.                                  - 13 -
  924. ................................................................................
  925.        CLEARFIELDS          ˇˇˇˇFIELD CONTROL     ˇˇˇˇˇˇˇˇˇCLEARFIELDS
  926.  
  927.        The "Clearfields" control blanks out all other fields on a form
  928.        or procedure input screen whenever the field containing the
  929.        control is changed.
  930.  
  931.        The primary use for the "Clearfields" control is to force
  932.        default lookups to re-derive for procedures which edit data.
  933.  
  934.        For Example - If you wrote a procedure to alter customers
  935.        addresses and telephone numbers then you would have three
  936.        fields on the input screen.
  937.  
  938.        Accountno   derived   lookup(customers,accountno)
  939.  
  940.        address     derived   default(lookup(customers,address))
  941.  
  942.        Tel         derived   default(lookup(customers,tel))
  943.  
  944.        When you enter a customers account number, his old address and
  945.        telephone number will be looked up, but the "Default" function
  946.        will allow you to edit them. The procedure code would then
  947.        update the record with the new address and phone number.
  948.  
  949.        The problem is, that having entered an account number and
  950.        looked up the other fields, if you then realize you have
  951.        entered the wrong account number and change it, the other
  952.        fields will not re-derive because they now have a default
  953.        value.  To get them to lookup based on the new account number
  954.        you would have to take the cursor to each field and clear it
  955.        with the F6 key.
  956.  
  957.        you can automate this process by adding the "Clearfields"
  958.        control to the accountno derivation:-
  959.  
  960.        lookup(customers,accountno)[clearfields]
  961.  
  962.  
  963.        Note:  The "Clearfields" control will only work when appended
  964.        to a derivation which is already dependent on the value of the
  965.        field. If you want to clear fields based on a change to a field
  966.        which has no other derivation then you must derive the field
  967.        with its own name plus the "Clearfields" control.
  968.  
  969.        In a field "Number" the derivation - Number[clearfields] - will
  970.        clear all other fields when the "Number" field is edited but
  971.        the derivation [clearfields] will have no effect.
  972.  
  973.  
  974.  
  975.  
  976.  
  977.  
  978.  
  979.  
  980.                                  - 14 -
  981. ................................................................................
  982.        COMPOUND INDEX       ˇˇˇˇˇˇˇMETHOD         ˇˇˇˇˇˇCOMPOUND INDEX
  983.  
  984.        If you need to list records from a form in such a way that they
  985.        are grouped by one field but with each record in the group
  986.        ordered by another then you can either use a compound index
  987.        field or "Subindex" the group during the procedure.
  988.  
  989.        A compound index field is simply an additional field in which
  990.        the contents of two or more fields are compounded using the
  991.        "Jointext" function. The field is indexed and the index on that
  992.        field can then be used to select records with the desired group
  993.        ordering.
  994.  
  995.        For example:- A "Videos" form has fields for "Title",
  996.        "RentalPrice" and "Category".
  997.  
  998.        To list the records grouped by "Category" but with the "Titles"
  999.        in each category in alphabetic order you add another field to
  1000.        the form which is Text, Indexed and long enough to hold the
  1001.        contents of both the "category" and "Title" fields. The field
  1002.        is derived by joining the text of the "Category" and "Title"
  1003.        fields.
  1004.  
  1005.        There are a couple of minor complications in creating compound
  1006.        index fields. Firstly the "Jointext" function by default strips
  1007.        any trailing space characters from the text it is joining. If a
  1008.        straight "Jointext" function was used and the first two videos
  1009.        entered were "A Bridge Too Far" and "Snow White" then the
  1010.        compound fields would derive as:-
  1011.  
  1012.        "WarA Bridge Too Far"  and
  1013.        "CartoonSnow White"
  1014.  
  1015.        When what you need is:-
  1016.  
  1017.        "War      A Bridge Too Far"  and
  1018.        "Cartoon  Snow White      "
  1019.  
  1020.        To produce the desired spacing in the compound field use the
  1021.        "Spacepad" function.
  1022.  
  1023.        If the length of the "Category" field is 15 then derive the
  1024.        compound field with - Jointext(spacepad(category,15),title)
  1025.  
  1026.        If you are compounding more than two fields then "spacepad" all
  1027.        the fields being joined to their own field's length except the
  1028.        last one.
  1029.  
  1030.        The maximum length of a text field in Easy Base is 80
  1031.        characters. If the fields you need to compound total more than
  1032.        80 then you must reduce the length of the field names. Compound
  1033.        indices in Text Block fields should not be used.
  1034.  
  1035.  
  1036.  
  1037.                                  - 15 -
  1038. ................................................................................
  1039.        COMPOUND INDEX       ˇˇˇˇˇˇˇMETHOD         ˇˇˇˇˇˇCOMPOUND INDEX
  1040.  
  1041.        Once you have created a compound field and checked that it
  1042.        derives correctly it is normal to define it as invisible and no
  1043.        entry anyway as it is not its contents that are of interest but
  1044.        the order which its index produces.
  1045.  
  1046.        Ex.   Assuming the compound field was called "catgroup"
  1047.  
  1048.        ..........................code..................
  1049.        for videos with catgroup in order
  1050.           print list items
  1051.        next
  1052.        ........................format.................
  1053.        .List Items
  1054.              {Videos.Category Field}     {Videos.Title Field}
  1055.        .End
  1056.  
  1057.  
  1058.        Ex.
  1059.  
  1060.  
  1061.        ...........................code....................
  1062.        declare variables
  1063.           catcheck as text
  1064.        end
  1065.        for videos with catgroup in order
  1066.           if catcheck <> videos,category then print group header
  1067.           catcheck = videos.category
  1068.           print list items
  1069.        next
  1070.        ..........................format...............
  1071.        .Group Header
  1072.           -------------------------------------
  1073.           Films categorized as {category field}
  1074.           -------------------------------------
  1075.        .List Items
  1076.                      {Title field}
  1077.        .End
  1078.  
  1079.        There is yet a further complication if one or more of the
  1080.        fields to be compounded is numeric. Easy Base index files are
  1081.        sorted alphabetically if the field is text and numerically if
  1082.        the field is numeric. A compound field is always text so if you
  1083.        need to compound a numeric field you have to ensure that it
  1084.        will sort alphabetically to the same order that it sorts
  1085.        numerically. The text of numeric values sort alphabetically to
  1086.        the same order as their values only if they all have the same
  1087.        number of digits either side of the decimal point.
  1088.  
  1089.        6  12 and 34 sort alphabetically as 12  34  6
  1090.        but
  1091.        06 12 and 34 sort alphabetically as 06  12  34
  1092.  
  1093.  
  1094.                                  - 16 -
  1095. ................................................................................
  1096.        COMPOUND INDEX       ˇˇˇˇˇˇˇMETHOD         ˇˇˇˇˇˇCOMPOUND INDEX
  1097.  
  1098.        Easy Base provides the function "Zeropad" to pad numbers to the
  1099.        same length for compounding.  The "Zeropad" function has three
  1100.        parameters - The number to be padded, the number of digits left
  1101.        of the decimal to pad to and the number of digits right of the
  1102.        decimal to pad to. All three parameters must be supplied. If
  1103.        the number is an integer then the third parameter is 0.
  1104.  
  1105.        Ex. To list the "Videos" records grouped by rental price with
  1106.        the titles in each price group in order you would create a
  1107.        compound field derived with:-
  1108.  
  1109.        Jointext(zeropad(rentalprice,2,2),title)
  1110.  
  1111.        Ex.
  1112.  
  1113.        A "Ships" form has fields for "Type" and "Displacement"
  1114.  
  1115.        To list the ships grouped by type with the Displacement in each
  1116.        group in order you would create a compound field derived with:-
  1117.  
  1118.        jointext(spacepad(type,15),zeropad(displacement,8,0))
  1119.  
  1120.        In many cases where you wish to compound a mixture of text and
  1121.        numeric fields you will require the numeric values to be listed
  1122.        in descending order while the text value is to be in alphabetic
  1123.        order.
  1124.  
  1125.        In the above example for ships, had you wished each group to
  1126.        be listed with "Displacement" in descending order you would
  1127.        derive the compound field as:-
  1128.  
  1129.        jointext(spacepad(type,15),reverse(zeropad(displacement,8,0)))
  1130.  
  1131.        The "Reverse" function simply inverts the ACSII number of each
  1132.        character in its parameter so that it will sort in reverse
  1133.        order in the index file.
  1134.  
  1135.        The "Reverse" function works equally well on text values
  1136.        although reverse alphabetic lists are seldom required.
  1137.  
  1138.        The "Zeropad" function will only pad out a number to the size
  1139.        required. It will not trim the number if it is already longer
  1140.        than one of the pad lengths. You should not therefore create
  1141.        compound fields with Floating Point numbers.
  1142.  
  1143.        If you compound a date or time field you should zeropad it to
  1144.        5,0 as the text which will be used is actually the date or time
  1145.        fields numeric value.
  1146.  
  1147.  
  1148.  
  1149.  
  1150.  
  1151.                                  - 17 -
  1152. ................................................................................
  1153.        COPY ALL FROM        ˇˇPROCEDURE COMMAND   ˇˇˇˇˇˇˇCOPY ALL FROM
  1154.  
  1155.        When you are transferring values from the fields of one form to
  1156.        the fields of another in preparation for a "New Record" or
  1157.        "Update Record"  you can use "Copy All From" to save time.
  1158.  
  1159.        Ex.
  1160.  
  1161.        for invoiceitems new record
  1162.           invoiceitems.item = input.item
  1163.           invoiceitems.price = input.price
  1164.           invoiceitems.quantity = input.quantity
  1165.           invoiceitems.vatrate = input.vatrate
  1166.        next
  1167.  
  1168.        can be replaced with:-
  1169.  
  1170.        for invoiceitems new record
  1171.           copy all from input
  1172.        next
  1173.  
  1174.        The data transfer in a "Copy All From" is based on the source
  1175.        and destination fields having the same name.
  1176.  
  1177.        If the source and destination fields have different data types
  1178.        Easy Base will attempt a conversion.
  1179.  
  1180.        The conversion will succeed between different numeric types and
  1181.        from numeric to text. It will fail from text to numeric and
  1182.        between any mismatch of date and time.
  1183.  
  1184.  
  1185.  
  1186.  
  1187.        See also:-  Derive Off, Duplicate Prevention
  1188.  
  1189.  
  1190.  
  1191.  
  1192.  
  1193.  
  1194.  
  1195.  
  1196.  
  1197.  
  1198.  
  1199.  
  1200.  
  1201.  
  1202.  
  1203.  
  1204.  
  1205.  
  1206.  
  1207.  
  1208.                                  - 18 -
  1209. ................................................................................
  1210.        CORRECTING STATS.    ˇˇˇˇˇˇˇMETHOD         ˇˇˇCORRECTING STATS.
  1211.  
  1212.        If you write an application in which records are entered via
  1213.        procedures and "running" statistics are kept, you will have to
  1214.        provide procedures which allow the user to correct any mistakes
  1215.        he has made.
  1216.  
  1217.        For Example: - In a "Time Sheets" application the user enters a
  1218.        time and customer on the input screen of a procedure. The
  1219.        procedure then calculates the charge, writes the charge and
  1220.        customers name to the "Timesheet" form, adds the charge to the
  1221.        "Balance" field in the "Customers" form and also adds it to the
  1222.        "Total" field in the "Workinhand" form.
  1223.  
  1224.        If the operator makes an error then correcting the entry in the
  1225.        "Timesheet" form is simply a case of updating it but to correct
  1226.        the "Balance" and "Total" fields you must add the corrected
  1227.        value and subtract the old incorrect value.
  1228.  
  1229.        To get the two values together for your procedure, create an
  1230.        input screen where the operator enters the "line" ("line" is
  1231.        the unique sequenced field in "Timesheet").  Then create two
  1232.        fields for the values. The first, "oldval" is derived
  1233.        lookup(timesheet,charge) and the second, "newval" is derived
  1234.        default(lookup(timesheet,charge).
  1235.  
  1236.        The "Oldval" field can be invisible and has no user entry.
  1237.  
  1238.        You would also add two similarly derived fields "Oldcustomer"
  1239.        and "Newcustomer".
  1240.  
  1241.        When the user edits the "Newval" and/or "Newcustomer" field and
  1242.        presses F2 , all the required values are available to the
  1243.        procedure code:-
  1244.  
  1245.        pause off : escape off
  1246.        for timesheet with line = input.line
  1247.           timesheet.charge = input.newval
  1248.           timesheet.customer = input.newcustomer
  1249.           update record
  1250.        next
  1251.        for customers with name = input.oldcustomer
  1252.           customers.balance = customers.balance - input.oldval
  1253.           update record
  1254.        next
  1255.        for customers with name = input.newcustomer
  1256.           customers.balance = customers.balance + input.newval
  1257.           update record
  1258.        next
  1259.        for workinhand
  1260.          workinhand.total = workinhand.total+input.newval-input.oldval
  1261.          update record
  1262.        next
  1263.  
  1264.  
  1265.                                  - 19 -
  1266. ................................................................................
  1267.        CREATE TEMP AS       ˇˇPROCEDURE COMMAND   ˇˇˇˇˇˇCREATE TEMP AS
  1268.  
  1269.        The "Create Temp As" command makes a temporary form during a
  1270.        procedure. There are two main uses for the temporary form.
  1271.  
  1272.        1.  To physically sort the records in a form.
  1273.  
  1274.        Ex.
  1275.  
  1276.        create temp as addresses
  1277.        index off:pause off:escape off:derive off
  1278.        for addresses with surname in order
  1279.           for temp new record
  1280.           copy all from addresses
  1281.        next
  1282.        rename temp as addresses
  1283.  
  1284.        The other main use for the temporary file is to save time when
  1285.        the majority of records in a form are to be deleted.
  1286.  
  1287.        Ex.
  1288.  
  1289.        A purchases ledger form is to be cleared down at the year end
  1290.        but any unreconciled payment entries are to be retained and
  1291.        flagged as last years. If there were 15000 records in the form
  1292.        of which only 50 were unreconciled then the procedure
  1293.  
  1294.        for purchases
  1295.           if purchases.reconciled = "yes" then
  1296.              delete record
  1297.           else
  1298.              purchases.lastyear = "yes"
  1299.              update record
  1300.           end if
  1301.        next
  1302.  
  1303.        would not only take a very long time to run but would leave the
  1304.        form full of deleted records and it would have to be re-packed.
  1305.  
  1306.        The same result can be achieved very quickly and without the
  1307.        need to re-pack with the following procedure.
  1308.  
  1309.        create temp as purchases
  1310.        for purchases with reconciled = "no"
  1311.           for temp new record
  1312.              copy all from purchases
  1313.              temp.lastyear = "yes"
  1314.           next
  1315.        next
  1316.        rename temp as purchases
  1317.  
  1318.        Do not use the "Clear Records" command to wipe the old file
  1319.        before using "Rename Temp As".  If you suffered a power failure
  1320.        after clearing and before renaming you would lose your data.
  1321.  
  1322.                                  - 20 -
  1323. ................................................................................
  1324.        CURRENT              ˇˇDERIVATION PREFIX   ˇˇˇˇˇˇˇˇˇˇˇˇˇCURRENT
  1325.  
  1326.        In Easy Base, fields are not normally derived when a previously
  1327.        entered record is viewed on screen. You can force a field to be
  1328.        rederived when viewed by prefixing the derivation with
  1329.        "current".
  1330.  
  1331.        Ex.  An invoice form has three fields Ivdate,Cdate and age.
  1332.  
  1333.        Ivdate is derived as   "system date"
  1334.        Cdate is derived as    "current system date"
  1335.        age is derived as      jointext(Cdate-Ivdate," Days old")
  1336.  
  1337.        Each time a record is viewed the Cdate field is rederived with
  1338.        the current system date and the age field shows the number of
  1339.        days since the record was filed.
  1340.  
  1341.        Ex.
  1342.  
  1343.        A form is used to price a certain job. It consists of fields
  1344.        for materials and their prices which are looked up from a
  1345.        "stock" form. If the primary lookup fields are prefixed with
  1346.        "current"   -  "current lookup(stock,item)"
  1347.  
  1348.        then each time a record is viewed it will reprice the job using
  1349.        the latest prices from the "stock" file.
  1350.  
  1351.        Please note that in the case of lookups, prefixing a secondary
  1352.        lookup has no effect. In the above example
  1353.  
  1354.          "current lookup(stock,price)"  would not work
  1355.  
  1356.        Provided that the primary lookup field is prefixed with
  1357.        "current" then any secondary lookups will also be rederived.
  1358.  
  1359.  
  1360.        The values of "Current" fields are also rederived whenever they
  1361.        are accessed in procedure code but they are NOT REDERIVED when
  1362.        they are accessed by a Lookup function.
  1363.  
  1364.  
  1365.        Note: You can only have one prefix on any one field derivation.
  1366.  
  1367.  
  1368.  
  1369.  
  1370.  
  1371.  
  1372.  
  1373.  
  1374.  
  1375.  
  1376.  
  1377.  
  1378.  
  1379.                                  - 21 -
  1380. ................................................................................
  1381.        CURRENT RECORD       ˇˇˇˇSYSTEM VALUE      ˇˇˇˇˇˇCURRENT RECORD
  1382.  
  1383.        Whenever a procedure is processing a "FOR" loop the number of
  1384.        the record being processed is available in the "Current Record"
  1385.        system value. The "Current Record" value is the records actual
  1386.        number in the form, not the number of records processed.
  1387.  
  1388.        Ex.
  1389.  
  1390.        for books with category = "fiction"
  1391.           count = count + 1
  1392.           Posn = current record
  1393.        next
  1394.  
  1395.        If the first book found with the category "fiction" is the
  1396.        fifteenth record in the file then count will return 1 and
  1397.        Posn will return 15.
  1398.  
  1399.  
  1400.        The "Current Record" value has no meaning in field derivations.
  1401.  
  1402.  
  1403.  
  1404.  
  1405.  
  1406.  
  1407.  
  1408.  
  1409.  
  1410.  
  1411.  
  1412.  
  1413.  
  1414.  
  1415.  
  1416.  
  1417.  
  1418.  
  1419.  
  1420.  
  1421.  
  1422.  
  1423.  
  1424.  
  1425.  
  1426.  
  1427.  
  1428.  
  1429.  
  1430.  
  1431.  
  1432.  
  1433.  
  1434.  
  1435.  
  1436.                                  - 22 -
  1437. ................................................................................
  1438.        DATE                 ˇˇˇˇˇFIELD TYPE       ˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇDATE
  1439.  
  1440.        Date fields hold dates in the eight character format 11/11/94
  1441.  
  1442.        The assumed century runs from the first of January 1981 to the
  1443.        31st of december 2080.
  1444.  
  1445.        You can select whether you wish your dates to be displayed as
  1446.        day/month/year (European) or month/day/year (North American)
  1447.        from the "options" item on the utilities menu.
  1448.  
  1449.        You can perform addition and subtraction operations on date
  1450.        values in days.
  1451.  
  1452.        Ex.  System date + 30
  1453.  
  1454.        Arithmetic operations are only correct for the assumed century.
  1455.  
  1456.        Date fields are automatically checked for validity by the
  1457.        system.
  1458.  
  1459.        Easy base does not provide a ready made ten character date
  1460.        field but you can define one with the "Formatted Text" field
  1461.        type.
  1462.  
  1463.  
  1464.        See Also:-   Makedate
  1465.  
  1466.  
  1467.  
  1468.  
  1469.  
  1470.  
  1471.  
  1472.  
  1473.  
  1474.  
  1475.  
  1476.  
  1477.  
  1478.  
  1479.  
  1480.  
  1481.  
  1482.  
  1483.  
  1484.  
  1485.  
  1486.  
  1487.  
  1488.  
  1489.  
  1490.  
  1491.  
  1492.  
  1493.                                  - 23 -
  1494. ................................................................................
  1495.        DATETEXT             ˇˇˇˇˇˇFUNCTION        ˇˇˇˇˇˇˇˇˇˇˇˇDATETEXT
  1496.  
  1497.        This function returns the date parameter in the form:-
  1498.  
  1499.        14th October 1994  or
  1500.        October 14th 1994  depending on the date format selected in
  1501.                           the utilities menu.
  1502.  
  1503.  
  1504.        Ex.    datetext(system date)
  1505.  
  1506.        Ex.    datetext(invoicedate + 30)
  1507.  
  1508.        Acceptable parameters:
  1509.  
  1510.        System date
  1511.        Date field
  1512.        Makedate function
  1513.        Date expression
  1514.  
  1515.  
  1516.  
  1517.  
  1518.  
  1519.  
  1520.  
  1521.  
  1522.  
  1523.  
  1524.  
  1525.  
  1526.  
  1527.  
  1528.  
  1529.  
  1530.  
  1531.  
  1532.  
  1533.  
  1534.  
  1535.  
  1536.  
  1537.  
  1538.  
  1539.  
  1540.  
  1541.  
  1542.  
  1543.  
  1544.  
  1545.  
  1546.  
  1547.  
  1548.  
  1549.  
  1550.                                  - 24 -
  1551. ................................................................................
  1552.        DAYOFMONTH           ˇˇˇˇˇˇFUNCTION        ˇˇˇˇˇˇˇˇˇˇDAYOFMONTH
  1553.  
  1554.        This function returns the day no.(1-31) of the date parameter.
  1555.  
  1556.        Ex. dayofmonth(system date)
  1557.  
  1558.        Ex  dayofmonth(registered)
  1559.  
  1560.        Ex.
  1561.  
  1562.        if dayofmonth(system date) = 28 then
  1563.           for statements with settled = "No"
  1564.              statements.overdue = "Yes"
  1565.              update record
  1566.           next
  1567.        end if
  1568.  
  1569.        Acceptable parameters:
  1570.  
  1571.        System date
  1572.        Date field
  1573.        Makedate function
  1574.        Date expression
  1575.  
  1576.  
  1577.  
  1578.  
  1579.  
  1580.  
  1581.  
  1582.  
  1583.  
  1584.  
  1585.  
  1586.  
  1587.  
  1588.  
  1589.  
  1590.  
  1591.  
  1592.  
  1593.  
  1594.  
  1595.  
  1596.  
  1597.  
  1598.  
  1599.  
  1600.  
  1601.  
  1602.  
  1603.  
  1604.  
  1605.  
  1606.  
  1607.                                  - 25 -
  1608. ................................................................................
  1609.        DAYOFWEEK            ˇˇˇˇˇˇFUNCTION        ˇˇˇˇˇˇˇˇˇˇˇDAYOFWEEK
  1610.  
  1611.        This function returns the day no.(1-7) of the date parameter.
  1612.  
  1613.        Ex.  dayofweek(system date)
  1614.  
  1615.        Ex.  day = spellday(dayofweek(diary.date))
  1616.  
  1617.        Ex.  The following procedure, if called from a batch execute
  1618.        menu will only run on a Monday.
  1619.  
  1620.        declare output fields
  1621.           takings.date
  1622.           takings.dailytotal
  1623.        end
  1624.        if dayofweek(system date) = 1 then
  1625.           for takings with date in reverse order
  1626.              print list items
  1627.              if system date - takings.date > 7 then exit for
  1628.           next
  1629.        end if
  1630.  
  1631.        Acceptable parameters:
  1632.  
  1633.        System date
  1634.        Date field
  1635.        Makedate function
  1636.        Date expression
  1637.  
  1638.  
  1639.  
  1640.  
  1641.  
  1642.  
  1643.  
  1644.  
  1645.  
  1646.  
  1647.  
  1648.  
  1649.  
  1650.  
  1651.  
  1652.  
  1653.  
  1654.  
  1655.  
  1656.  
  1657.  
  1658.  
  1659.  
  1660.  
  1661.  
  1662.  
  1663.  
  1664.                                  - 26 -
  1665. ................................................................................
  1666.        DAYOFYEAR            ˇˇˇˇˇˇFUNCTION        ˇˇˇˇˇˇˇˇˇˇˇDAYOFYEAR
  1667.  
  1668.        This function returns the day no.(1-365) of the date parameter.
  1669.  
  1670.        Ex.   dayofyear(system date)
  1671.  
  1672.        Ex.   days = dayofyear(events.date)
  1673.  
  1674.        Acceptable parameters:
  1675.  
  1676.        System date
  1677.        Date field
  1678.        Makedate function
  1679.        Date expression
  1680.  
  1681.  
  1682.  
  1683.  
  1684.  
  1685.  
  1686.  
  1687.  
  1688.  
  1689.  
  1690.  
  1691.  
  1692.  
  1693.  
  1694.  
  1695.  
  1696.  
  1697.  
  1698.  
  1699.  
  1700.  
  1701.  
  1702.  
  1703.  
  1704.  
  1705.  
  1706.  
  1707.  
  1708.  
  1709.  
  1710.  
  1711.  
  1712.  
  1713.  
  1714.  
  1715.  
  1716.  
  1717.  
  1718.  
  1719.  
  1720.  
  1721.                                  - 27 -
  1722. ................................................................................
  1723.        DECLARE              ˇˇPROCEDURE COMMAND   ˇˇˇˇˇˇˇˇˇˇˇˇˇDECLARE
  1724.  
  1725.        If you write a procedure which outputs information to the
  1726.        screen, printer or a disk file you must start it by declaring
  1727.        the output fields.
  1728.  
  1729.        Ex.
  1730.        Declare output fields
  1731.           Input.name
  1732.           Customers.name:customers.address:customers.acno
  1733.           countofinvoices
  1734.        end
  1735.  
  1736.        If fields you intend to print exist in a form then declare them
  1737.        as Formname.Fieldname.  Fields from the procedures Input Screen
  1738.        are declared as Input.fieldname. Easy Base will then use the
  1739.        field definitions from the form as defaults when you create the
  1740.        Output Format for the procedure.
  1741.  
  1742.        If a field which you intend to print is to be derived during
  1743.        the procedure and does not exist in a form as "countofinvoices"
  1744.        you can give it any name you wish up to forty characters but
  1745.        the name must not contain a ".". Once you have declared fields
  1746.        you can create the Output Format.
  1747.  
  1748.        If you declare an "Ad Hoc" field such as "countovinvoices" then
  1749.        you must include it in the format in order to define its type
  1750.        and length.
  1751.  
  1752.        If you require variables to store values during a procedure but
  1753.        you will not be out-putting their values then declare them as
  1754.        variables not fields.
  1755.  
  1756.        Ex.
  1757.  
  1758.        declare variables
  1759.           count as number
  1760.           lasttype as text
  1761.        end
  1762.  
  1763.        Unprinted variables can only have one of the two types "Number"
  1764.        or "Text".
  1765.  
  1766.        Field declarations must precede Variable declarations and both
  1767.        must precede executable code.
  1768.  
  1769.  
  1770.  
  1771.  
  1772.  
  1773.  
  1774.  
  1775.  
  1776.  
  1777.  
  1778.                                  - 28 -
  1779. ................................................................................
  1780.        DEFAULT              ˇˇˇˇˇˇFUNCTION        ˇˇˇˇˇˇˇˇˇˇˇˇˇDEFAULT
  1781.  
  1782.        This function returns the parameter if not overridden by user
  1783.        entry.
  1784.  
  1785.  
  1786.        Ex.    Default(5)
  1787.  
  1788.        Ex.    Default(system date)
  1789.  
  1790.        Ex.    Default(lookup(stock,price))
  1791.  
  1792.        The Default function is only used in form and input screen
  1793.        field derivations - It has no meaning in procedure code.
  1794.  
  1795.        Acceptable parameters
  1796.  
  1797.        Any value, expression, field, variable or nested function of
  1798.        the same type as the field in which it is used.
  1799.  
  1800.  
  1801.  
  1802.  
  1803.  
  1804.  
  1805.  
  1806.  
  1807.  
  1808.  
  1809.  
  1810.  
  1811.  
  1812.  
  1813.  
  1814.  
  1815.  
  1816.  
  1817.  
  1818.  
  1819.  
  1820.  
  1821.  
  1822.  
  1823.  
  1824.  
  1825.  
  1826.  
  1827.  
  1828.  
  1829.  
  1830.  
  1831.  
  1832.  
  1833.  
  1834.  
  1835.                                  - 29 -
  1836. ................................................................................
  1837.        DELAY                ˇˇˇˇFIELD CONTROL     ˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇDELAY
  1838.  
  1839.        The "delay" control suspends processing for a given number of
  1840.        milliseconds.
  1841.  
  1842.        Ex.
  1843.  
  1844.        A procedure screen is used from a startup Batch execute menu as
  1845.        an opening screen to an application and has the following field
  1846.        derivations
  1847.  
  1848.        1.  "Welcome to this wonderful program" [delay 1000]
  1849.  
  1850.        2.  "Copyright Fred blogs"[delay 1000]
  1851.  
  1852.        3.  "Press F2 to start"
  1853.  
  1854.        If the field colours are "text" ,"alt1" or "alt2" then the
  1855.        three fields will "Popup" with a one second delay between each.
  1856.  
  1857.  
  1858.  
  1859.  
  1860.  
  1861.  
  1862.  
  1863.  
  1864.  
  1865.  
  1866.  
  1867.  
  1868.  
  1869.  
  1870.  
  1871.  
  1872.  
  1873.  
  1874.  
  1875.  
  1876.  
  1877.  
  1878.  
  1879.  
  1880.  
  1881.  
  1882.  
  1883.  
  1884.  
  1885.  
  1886.  
  1887.  
  1888.  
  1889.  
  1890.  
  1891.  
  1892.                                  - 30 -
  1893. ................................................................................
  1894.        DELAY                ˇˇPROCEDURE COMMAND   ˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇDELAY
  1895.  
  1896.        The "Delay" command suspends processing for a given number of
  1897.        milliseconds (1 - 5000).
  1898.  
  1899.        Ex.
  1900.  
  1901.        declare variables
  1902.           x as number : total as number
  1903.        end
  1904.        for customers
  1905.           total = 0
  1906.           for invoices with acno = customers.acno
  1907.              display status "Totalling invoices for" + Customers.name
  1908.              delay 200
  1909.              customers.balance = total
  1910.              update record
  1911.           next
  1912.        next
  1913.  
  1914.        In the above example, wherever a customer only has one or two
  1915.        invoices to total, the status display would change very
  1916.        quickly.  By including a 200 millisecond delay you can ensure
  1917.        that each customers name is on screen at least long enough to
  1918.        be read.
  1919.  
  1920.        Delay values outside of 1 - 5000 are ignored.
  1921.  
  1922.  
  1923.  
  1924.  
  1925.  
  1926.  
  1927.  
  1928.  
  1929.  
  1930.  
  1931.  
  1932.  
  1933.  
  1934.  
  1935.  
  1936.  
  1937.  
  1938.  
  1939.  
  1940.  
  1941.  
  1942.  
  1943.  
  1944.  
  1945.  
  1946.  
  1947.  
  1948.  
  1949.                                  - 31 -
  1950. ................................................................................
  1951.        DELETE CHOICE LISTS  ˇˇˇˇˇˇUTILITY         ˇDELETE CHOICE LISTS
  1952.  
  1953.        If you have Choice lists for choice fields that are no longer
  1954.        required you can delete them with this utility.
  1955.  
  1956.  
  1957.  
  1958.  
  1959.  
  1960.  
  1961.  
  1962.  
  1963.  
  1964.  
  1965.  
  1966.  
  1967.  
  1968.  
  1969.  
  1970.  
  1971.  
  1972.  
  1973.  
  1974.  
  1975.  
  1976.  
  1977.  
  1978.  
  1979.  
  1980.  
  1981.  
  1982.  
  1983.  
  1984.  
  1985.  
  1986.  
  1987.  
  1988.  
  1989.  
  1990.  
  1991.  
  1992.  
  1993.  
  1994.  
  1995.  
  1996.  
  1997.  
  1998.  
  1999.  
  2000.  
  2001.  
  2002.  
  2003.  
  2004.  
  2005.  
  2006.                                  - 32 -
  2007. ................................................................................
  2008.        DELETE RECORD        ˇˇPROCEDURE COMMAND   ˇˇˇˇˇˇˇDELETE RECORD
  2009.  
  2010.        The "Delete Record" command is used for the selective deletion
  2011.        of records in a form.
  2012.  
  2013.        Ex.
  2014.  
  2015.        for books with title = input.title
  2016.           delete record
  2017.        next
  2018.  
  2019.        This deletes the single book whose title is that entered on the
  2020.        input screen.
  2021.  
  2022.        for books with author = input.author
  2023.           delete record
  2024.        next
  2025.  
  2026.        This deletes the records of all books by the author entered on
  2027.        the input screen.
  2028.  
  2029.        When you use the "Delete Record" command it has the same effect
  2030.        as deleting a record in data entry. In other words the record
  2031.        is marked for deletion but will not actually be removed from
  2032.        the form until the next re-pack.
  2033.  
  2034.        If you use the "Delete Record" command to delete large numbers
  2035.        of records then you should pack the form afterward.
  2036.  
  2037.        If you wish to delete all records in a form use the "Clear
  2038.        records" command not the "Delete Record" command.
  2039.  
  2040.  
  2041.  
  2042.  
  2043.  
  2044.  
  2045.  
  2046.  
  2047.  
  2048.  
  2049.  
  2050.  
  2051.  
  2052.  
  2053.  
  2054.  
  2055.  
  2056.  
  2057.  
  2058.  
  2059.  
  2060.  
  2061.  
  2062.  
  2063.                                  - 33 -
  2064. ................................................................................
  2065.        DERIVE OFF           ˇˇPROCEDURE COMMAND   ˇˇˇˇˇˇˇˇˇˇDERIVE OFF
  2066.  
  2067.        Whenever an Easy Base procedure adds or updates a record then
  2068.        by default it checks the derivations of all fields during an
  2069.        add operation and any fields that are affected by an update
  2070.        operation. In other words, if you update the netprice field in
  2071.        a stock form and that form has derived fields for VAT and
  2072.        grossprice then those fields will also be updated.
  2073.  
  2074.        If the procedure adds or updates all fields then this process
  2075.        is superfluous and simply slows the procedure. You can disable
  2076.        form derivation checking with the "Derive Off" command.
  2077.  
  2078.        derive off
  2079.        for stock with item = input.item
  2080.           copy all from input
  2081.           update record
  2082.        next
  2083.  
  2084.        In the above example a stock form has several derived fields
  2085.        but the input screen also does the same derivations. There is
  2086.        therefore no need to re-check them when the record is updated.
  2087.  
  2088.        As a general rule, in procedures which add or update records
  2089.        from an input screen, you should derive all fields on the input
  2090.        screen rather than during the update process. The user will not
  2091.        notice the time taken to derive fields while he is filling them
  2092.        in but he will notice the time taken to derive them after he
  2093.        has pressed F2
  2094.  
  2095.        There is no corresponding "Derive On" command. Derivation
  2096.        checking is automatically turned back on at the end of the
  2097.        loop to which is prefixed by the "Derive Off" command. If you
  2098.        require derivation checking to be off for more than one loop in
  2099.        a procedure then you must issue the command before each loop.
  2100.  
  2101.  
  2102.        Note:-
  2103.  
  2104.        If the "Derive Off" command is not issued before a loop then
  2105.        form level derivations override procedure derivations. This is
  2106.        not normally a problem, but can be if you try to change the
  2107.        case of a field for printing.
  2108.  
  2109.        For customers
  2110.           customers.name = proper(customers.name)
  2111.           print list items
  2112.        next
  2113.  
  2114.        If the "Name" field on the "Customers" form is derived as
  2115.        Upper(name) then the procedure will print the customers names
  2116.        in upper case.  You can overcome the problem either by
  2117.        cancelling the field derivation or by transferring the
  2118.        customers name to a variable and converting that to proper.
  2119.  
  2120.                                  - 34 -
  2121. ................................................................................
  2122.        DISPLAY STATUS       ˇˇPROCEDURE COMMAND   ˇˇˇˇˇˇDISPLAY STATUS
  2123.  
  2124.        If you write a procedure which has no output then Easy Base
  2125.        will display a "Running" flash at the top right hand side of
  2126.        the screen. For procedures which only take a few seconds to run
  2127.        this is sufficient to let the operator know that something is
  2128.        happening. For procedures that take some time to complete you
  2129.        should include a status display showing the progress of the
  2130.        procedure. A status display not only allays the nagging
  2131.        suspicion that the system has hung up but also allows the
  2132.        operator to estimate how long it will take.
  2133.  
  2134.        To create a status display just issue the command "Display
  2135.        Status" followed by a message composed of text in quotation
  2136.        marks and fields or variables concatenated by the + sign.
  2137.  
  2138.        Ex.
  2139.  
  2140.  
  2141.        declare variables
  2142.           x as number : y as number
  2143.        end
  2144.        for employees with taxcode = input.oldtaxcode
  2145.           y = total copies :exit for    'get copies to y for display
  2146.        next
  2147.        for employees with taxcode = input.oldtaxcode
  2148.           x = x + 1
  2149.           display status "Updating Record" + x + "of" + y
  2150.           employees.taxcode = input.newtaxcode
  2151.           update record
  2152.        next
  2153.  
  2154.        The status line is displayed centrally in a small window when
  2155.        the procedure runs. A Status line can have a maximum of 68
  2156.        characters. If you create a status line of more than 68
  2157.        characters then it will be cut short to that length.
  2158.  
  2159.        If you need to display counters in two nested loops then write
  2160.        the full display line in the outer loop and "display status"
  2161.        with no parameters in the inner loop.
  2162.  
  2163.        for customers
  2164.           x = x + 1
  2165.           - loop statements -
  2166.           display status "Checking Invoice" + y + "of customer" + x
  2167.           for invoices with customer = customers.name
  2168.              y = y + 1
  2169.              - Loop Statements -
  2170.              display status
  2171.           next
  2172.        next
  2173.  
  2174.  
  2175.  
  2176.  
  2177.                                  - 35 -
  2178. ................................................................................
  2179.        DO..LOOP             ˇˇPROCEDURE COMMAND   ˇˇˇˇˇˇˇˇˇˇˇˇDO..LOOP
  2180.  
  2181.        The "Do" loop structure is used in the Easy Base Procedure code
  2182.        to repeat a series of commands or statements. Whenever a
  2183.        procedure reaches a "Do" command it repeats all the statements
  2184.        between the "Do" and the "Loop" statements until the loop is
  2185.        broken by an "Exit Do" command.
  2186.  
  2187.        Ex.
  2188.  
  2189.        The following code fragment prints 10 copies of the top fifty
  2190.        best selling items in a "stock" form.
  2191.  
  2192.  
  2193.        .........................code............................
  2194.        declare output fields
  2195.           stock.item : stock.sales : today
  2196.        end
  2197.        Declare variables
  2198.           copies as number : items as number
  2199.        end
  2200.        today = system date
  2201.        do
  2202.           copies = copies + 1 :items = 0
  2203.           if copies = 11 then exit do
  2204.           bold on
  2205.           print report header
  2206.           bold off
  2207.           for stock with sales in reverse order
  2208.              items = items + 1
  2209.              if items = 51 then exit for
  2210.              print list items
  2211.           next
  2212.           bold on : print report footer : bold off
  2213.           page feed
  2214.        loop
  2215.        ............................format.....................
  2216.        .Report Header
  2217.           ÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕ
  2218.           Top 50 Best Selling Items               {today field}
  2219.           ÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕ
  2220.        .list items
  2221.              {stock.item field}        {stock.sales field}
  2222.        .Report Footer
  2223.           ÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕ
  2224.        .end
  2225.  
  2226.  
  2227.  
  2228.  
  2229.  
  2230.  
  2231.  
  2232.  
  2233.  
  2234.                                  - 36 -
  2235. ................................................................................
  2236.        DUPLICATE PREVENTION ˇˇˇˇˇˇˇMETHOD         DUPLICATE PREVENTION
  2237.  
  2238.        1.  Where "Blank" values are acceptable.
  2239.  
  2240.        Quite often you will come across a situation where a field must
  2241.        not have duplicate entries but can still be left blank. You
  2242.        cannot define this field as unique because that would prevent
  2243.        more than one blank entry.  A good example of such a situation
  2244.        is in the "Menus Form" of Easy Base. The definition and unique
  2245.        field is the "Menu Title" but no two records may have the same
  2246.        entry in the sign on "Password" field.
  2247.  
  2248.        To prevent duplicate entries other than blanks you must enter a
  2249.        relationship between the form and itself with the field to be
  2250.        tested as the related field in both primary and secondary
  2251.        forms.
  2252.  
  2253.        The field is then derived as :-
  2254.  
  2255.        If(lookup(menus,password) <> blank,blank[beepDuplicate Password
  2256.                 !],password)
  2257.  
  2258.        2.   When entering records via procedures.
  2259.  
  2260.        When you use a procedure to enter a new record to a form it is
  2261.        not automatically checked as "Unique".   To ensure that
  2262.        duplicate entries are not entered via procedures you must check
  2263.        that the data entered on the procedures input screen is unique
  2264.        to the form you are about to enter it to before running the
  2265.        procedure.  For example: If you were about to enter a record to
  2266.        the "Manufacturers" form in which the "Name" field was unique
  2267.        then the "Name" field on the input screen would be derived:-
  2268.  
  2269.           if(lookup(manufacturers,name) <> blank,blank[beepDuplicate
  2270.                      Name !cursor name],name)
  2271.  
  2272.  
  2273.  
  2274.  
  2275.  
  2276.  
  2277.  
  2278.  
  2279.  
  2280.  
  2281.  
  2282.  
  2283.  
  2284.  
  2285.  
  2286.  
  2287.  
  2288.  
  2289.  
  2290.  
  2291.                                  - 37 -
  2292. ................................................................................
  2293.        ESCAPE ON/OFF        ˇˇPROCEDURE COMMAND   ˇˇˇˇˇˇˇESCAPE ON/OFF
  2294.  
  2295.        When a procedure is running in Easy Base, it cannot, by
  2296.        default, be interrupted. If your procedure simply lists data to
  2297.        the screen then the end user may not need to see the entire
  2298.        output. You can allow the user to terminate a procedure
  2299.        prematurely with the "Escape On" command.
  2300.  
  2301.        If a procedure performs several tasks, you can selectively
  2302.        enable and disable the Escape Key with the commands "Escape On"
  2303.        and "Escape" Off"
  2304.  
  2305.        Ex.
  2306.  
  2307.        For newpayscales
  2308.           print list items
  2309.        next
  2310.        escape off
  2311.        for newpayscales
  2312.           for employees with scale = newpayscales.scale
  2313.              employees.rate = newpayscales.rate
  2314.              update record
  2315.           next
  2316.        next
  2317.        escape on
  2318.        for employees
  2319.           print newpay
  2320.        next
  2321.  
  2322.        In the above example a procedure lists new pay scales, updates
  2323.        the "Employees" form with the new pay rate and then lists the
  2324.        employees with their new rates.
  2325.  
  2326.        While the procedure is running the operator can terminate it
  2327.        during either of the lists but he cannot terminate it during
  2328.        the process of updating the "Employees" form.
  2329.  
  2330.  
  2331.  
  2332.  
  2333.  
  2334.  
  2335.  
  2336.  
  2337.  
  2338.  
  2339.  
  2340.  
  2341.  
  2342.  
  2343.  
  2344.  
  2345.  
  2346.  
  2347.  
  2348.                                  - 38 -
  2349. ................................................................................
  2350.        EXIT BATCH MENU      ˇˇPROCEDURE COMMAND   ˇˇˇˇˇEXIT BATCH MENU
  2351.  
  2352.        The "Exit Batch Menu" command terminates a current Batch Menu
  2353.        and returns control to the menu which called it.
  2354.  
  2355.        Ex.
  2356.  
  2357.        An application starts with a batch menu which calls a second
  2358.        batch menu which performs regular daily tasks. It then calls
  2359.        the main user menu. If the application is exited after the
  2360.        daily tasks batch menu has been completed then you will not
  2361.        wish to re-run the daily tasks when the application is
  2362.        restarted on the same day. To prevent this create a form
  2363.        "tasksdone" with a single field "date" and enter a single
  2364.        record with yesterdays date.
  2365.  
  2366.        The first procedure on the daily tasks batch menu would then be
  2367.  
  2368.        for tasksdone
  2369.           if tasksdone.date = system date then
  2370.              exit batch menu
  2371.           else
  2372.              tasksdone.date = system date
  2373.              update record
  2374.           end if
  2375.        next
  2376.  
  2377.  
  2378.  
  2379.  
  2380.  
  2381.  
  2382.  
  2383.  
  2384.  
  2385.  
  2386.  
  2387.  
  2388.  
  2389.  
  2390.  
  2391.  
  2392.  
  2393.  
  2394.  
  2395.  
  2396.  
  2397.  
  2398.  
  2399.  
  2400.  
  2401.  
  2402.  
  2403.  
  2404.  
  2405.                                  - 39 -
  2406. ................................................................................
  2407.        EXIT PROCEDURE       ˇˇPROCEDURE COMMAND   ˇˇˇˇˇˇEXIT PROCEDURE
  2408.  
  2409.        The "Exit Procedure" command terminates a procedure.
  2410.  
  2411.        Ex.
  2412.  
  2413.        if input.codeword <> "fred" then exit procedure
  2414.        for staffconfidential with name = input.name
  2415.           print list items
  2416.        next
  2417.  
  2418.  
  2419.        If the procedure has a repeating input screen then this is
  2420.        cancelled by the "Exit Procedure" command.
  2421.  
  2422.  
  2423.  
  2424.  
  2425.  
  2426.  
  2427.  
  2428.  
  2429.  
  2430.  
  2431.  
  2432.  
  2433.  
  2434.  
  2435.  
  2436.  
  2437.  
  2438.  
  2439.  
  2440.  
  2441.  
  2442.  
  2443.  
  2444.  
  2445.  
  2446.  
  2447.  
  2448.  
  2449.  
  2450.  
  2451.  
  2452.  
  2453.  
  2454.  
  2455.  
  2456.  
  2457.  
  2458.  
  2459.  
  2460.  
  2461.  
  2462.                                  - 40 -
  2463. ................................................................................
  2464.        FIXED POINT          ˇˇˇˇˇFIELD TYPE       ˇˇˇˇˇˇˇˇˇFIXED POINT
  2465.  
  2466.        Fixed point fields can display up to 14 digits. They use the
  2467.        comma for thousands separation and the full stop for decimal
  2468.        separation.
  2469.  
  2470.        There are no rounding errors with fixed point fields.
  2471.  
  2472.        See - Operators arithmetic
  2473.  
  2474.  
  2475.  
  2476.  
  2477.  
  2478.  
  2479.  
  2480.  
  2481.  
  2482.  
  2483.  
  2484.  
  2485.  
  2486.  
  2487.  
  2488.  
  2489.  
  2490.  
  2491.  
  2492.  
  2493.  
  2494.  
  2495.  
  2496.  
  2497.  
  2498.  
  2499.  
  2500.  
  2501.  
  2502.  
  2503.  
  2504.  
  2505.  
  2506.  
  2507.  
  2508.  
  2509.  
  2510.  
  2511.  
  2512.  
  2513.  
  2514.  
  2515.  
  2516.  
  2517.  
  2518.  
  2519.                                  - 41 -
  2520. ................................................................................
  2521.        FLOATING POINT       ˇˇˇˇˇFIELD TYPE       ˇˇˇˇˇˇFLOATING POINT
  2522.  
  2523.        Floating point fields can display up to 14 digits. They do not
  2524.        have a thousands separator. They are left justified.
  2525.  
  2526.  
  2527.  
  2528.  
  2529.  
  2530.  
  2531.  
  2532.  
  2533.  
  2534.  
  2535.  
  2536.  
  2537.  
  2538.  
  2539.  
  2540.  
  2541.  
  2542.  
  2543.  
  2544.  
  2545.  
  2546.  
  2547.  
  2548.  
  2549.  
  2550.  
  2551.  
  2552.  
  2553.  
  2554.  
  2555.  
  2556.  
  2557.  
  2558.  
  2559.  
  2560.  
  2561.  
  2562.  
  2563.  
  2564.  
  2565.  
  2566.  
  2567.  
  2568.  
  2569.  
  2570.  
  2571.  
  2572.  
  2573.  
  2574.  
  2575.  
  2576.                                  - 42 -
  2577. ................................................................................
  2578.        FOR..NEXT            ˇˇPROCEDURE COMMAND   ˇˇˇˇˇˇˇˇˇˇˇFOR..NEXT
  2579.  
  2580.        The "For" command initiates loops which load records from forms
  2581.        for processing. All statements between the "For" and the "Next"
  2582.        commands are repeated for each record selected.
  2583.  
  2584.        Ex.
  2585.  
  2586.        For Videos
  2587.           If Videos.price = 2.00 then Videos.price = 2.50
  2588.           update record
  2589.        next
  2590.  
  2591.        In the above example each record in the "Videos" form is loaded
  2592.        into memory - the price field is checked and if it is 2.00 then
  2593.        it is altered to 2.50 - the record is then updated on disk.
  2594.  
  2595.        "For" loops can be nested to any depth.
  2596.  
  2597.        Ex.
  2598.  
  2599.        for videoprices
  2600.           for videos
  2601.              if videos.price = videoprices.price then
  2602.                 print list items
  2603.              end if
  2604.           next
  2605.        next
  2606.  
  2607.        In the above example the outer loop loads each record from the
  2608.        "Videoprices" form.  While each of these is in memory it then
  2609.        loads each record from the "Videos" form, tests to see if the
  2610.        price field in "Videos" is the same as the price field in
  2611.        "Videoprices" and if so prints the list items section of the
  2612.        report format (containing the video title field) thus grouping
  2613.        all video titles by price.
  2614.  
  2615.        If a "For" loop is unqualified as above then every record is
  2616.        processed starting at one and advancing in sequence. "For"
  2617.        loops can be qualified in several ways in order to select
  2618.        records in other orders or groups. The following qualifications
  2619.        are available:-
  2620.  
  2621.        For (form) with (fieldname) in order
  2622.        For (form) with (fieldname) in reverse order
  2623.        For (form) with (fieldname) =  (value)
  2624.        For (form) with (fieldname) >  (value)
  2625.        For (form) with (fieldname) <  (value)
  2626.        For (form) with (fieldname) >= (value)
  2627.        For (form) with (fieldname) <= (value)
  2628.        For (form) new record
  2629.  
  2630.        With the exception of the "New Record" qualification, all
  2631.        accept the suffix "Unique" and an "Alias" for the form name.
  2632.  
  2633.                                  - 43 -
  2634. ................................................................................
  2635.        FOR..NEXT            ˇˇPROCEDURE COMMAND   ˇˇˇˇˇˇˇˇˇˇˇFOR..NEXT
  2636.  
  2637.        If a "For" loop is qualified by "in order" or "in reverse
  2638.        order" then the records are selected in alphabetical or reverse
  2639.        alphabetical order if the selection field is text, and in
  2640.        numeric or reverse numeric order if the selection field is
  2641.        numeric.
  2642.  
  2643.        Ex.
  2644.  
  2645.        for books with title in order
  2646.           print list items
  2647.        next
  2648.  
  2649.        Ex.
  2650.  
  2651.        for salesmen with monthlysales in reverse order
  2652.           print list items
  2653.        next
  2654.  
  2655.        If a "For" loop is qualified by "in order unique" or "in
  2656.        reverse order unique" then records will be selected in order or
  2657.        in reverse order as above. However, where there are multiple
  2658.        occurrence of the same field value a "unique" loop will only
  2659.        select the first occurrence of each value if the loop is in
  2660.        order or the last occurrence if the loop is in reverse order.
  2661.  
  2662.        Ex.
  2663.  
  2664.        for books with category in order unique
  2665.           count = count + 1
  2666.           print list items
  2667.        next
  2668.        print categorycount
  2669.  
  2670.        This example prints and counts the different categories in the
  2671.        "books" form.
  2672.  
  2673.        Ex.
  2674.  
  2675.        for theatreseats with price in reverse order unique
  2676.           for seatprices new record
  2677.              seatprices.price = theatreseats.price
  2678.           next
  2679.        next
  2680.  
  2681.        The above example selects one example only of each seat price
  2682.        in an existing "theatreseats" form in descending price order
  2683.        and enters a new record in the new "seatprices" form.
  2684.  
  2685.  
  2686.  
  2687.  
  2688.  
  2689.  
  2690.                                  - 44 -
  2691. ................................................................................
  2692.        FOR..NEXT            ˇˇPROCEDURE COMMAND   ˇˇˇˇˇˇˇˇˇˇˇFOR..NEXT
  2693.  
  2694.        If a "For" loop is qualified by a "Fieldname = " condition then
  2695.        only the record or records where the field contents match the
  2696.        condition will be selected.
  2697.  
  2698.        Ex.
  2699.  
  2700.        for books with category = "fiction"
  2701.           print list items
  2702.        next
  2703.  
  2704.        This example prints all books which have the category "fiction"
  2705.  
  2706.        Ex.
  2707.  
  2708.        For customers with acno = input.acno
  2709.           creditlimit = input.creditlimit
  2710.           update record
  2711.        next
  2712.  
  2713.        In this example the procedure has an input screen where the
  2714.        operator enters a customers account number and new credit
  2715.        limit. On pressing F2 the procedure finds the single record in
  2716.        the "Customers" form which has the input account number and
  2717.        updates the "creditlimit" field.
  2718.  
  2719.  
  2720.  
  2721.  
  2722.  
  2723.  
  2724.  
  2725.  
  2726.  
  2727.  
  2728.  
  2729.  
  2730.  
  2731.  
  2732.  
  2733.  
  2734.  
  2735.  
  2736.  
  2737.  
  2738.  
  2739.  
  2740.  
  2741.  
  2742.  
  2743.  
  2744.  
  2745.  
  2746.  
  2747.                                  - 45 -
  2748. ................................................................................
  2749.        FOR..NEXT            ˇˇPROCEDURE COMMAND   ˇˇˇˇˇˇˇˇˇˇˇFOR..NEXT
  2750.  
  2751.        If a "For" loop is qualified by a "with (fieldname) > " or
  2752.        "with (fieldname) >= " condition then records are selected in
  2753.        order like the "with (fieldname) in order" qualification but
  2754.        starting with the first record where the field contents match
  2755.        the condition value rather than the first record.
  2756.  
  2757.        Similarly the qualifications "with (fieldname) < " and "with
  2758.        (fieldname) <= " select records in reverse order but starting
  2759.        with the last record to match the condition value.
  2760.  
  2761.        In case you are new to progamming it should be pointed out that
  2762.        the relational operators >, <, >= and <= can be applied to text
  2763.        as well as to numbers. When they are applied to text they
  2764.        relate to the text's alphabetical order.
  2765.  
  2766.        These four qualifications provide the means to select any
  2767.        subset of records which has a range of values in a particular
  2768.        field.
  2769.  
  2770.        Ex.
  2771.  
  2772.        for pupils with age > 6
  2773.           if pupils.age = 12 then exit for
  2774.           print list items
  2775.        next
  2776.  
  2777.        This example prints the names of all pupils between the ages of
  2778.        seven and eleven. The "For" qualification starts selection in
  2779.        numeric order of age starting at seven and the "Exit for"
  2780.        command terminates the loop when the first pupil aged twelve is
  2781.        loaded.
  2782.  
  2783.        Ex.
  2784.  
  2785.        A "Videos" form has a compound index field called "catorder"
  2786.        which is derived by joining the text of the "category" and
  2787.        "title" fields. The following procedure selects all the videos
  2788.        which have the category entered on the input screen and lists
  2789.        them with the title in alphabetic order.
  2790.  
  2791.        for videos with catorder >= input.category
  2792.           if videos.category > input.category then exit for
  2793.           print list items
  2794.        next
  2795.  
  2796.        Ex.
  2797.  
  2798.        for vehicles with seats > 4 unique
  2799.           count = count + 1
  2800.        next
  2801.  
  2802.        "count" returns the number of different seat capacities > 4
  2803.  
  2804.                                  - 46 -
  2805. ................................................................................
  2806.        FOR..NEXT            ˇˇPROCEDURE COMMAND   ˇˇˇˇˇˇˇˇˇˇˇFOR..NEXT
  2807.  
  2808.        If a "For" loop is qualified by "new record" then no records
  2809.        are selected from the form. Instead, a new blank record is
  2810.        created at the "For" command, all statements between the "For"
  2811.        and "Next" commands apply to this new record and it is entered
  2812.        to the form at the "Next" command.
  2813.  
  2814.        Ex.
  2815.  
  2816.        for books new record
  2817.           books.dateinstock = system date
  2818.           copy all from input
  2819.        next
  2820.  
  2821.        This example enters a new record to the "Books" form making the
  2822.        "dateinstock" field equal the system date and copying all other
  2823.        fields from the procedures input screen.
  2824.  
  2825.        Ex.
  2826.  
  2827.        declare variables
  2828.          hourcount as number
  2829.        end
  2830.        '..............clear last wages
  2831.        clear records from wagelist
  2832.        '..........count employees hours from timesheet...
  2833.        for employees
  2834.           hourcount = 0
  2835.           for timesheet with worksno = employees.worksno
  2836.              hourcount = hourcount + timesheet.hours
  2837.           next
  2838.           for wagelist new record
  2839.              wagelist.worksno = employees.worksno
  2840.              wagelist.name = employees.name
  2841.              wagelist.hours = hourcount
  2842.              wagelist.grosswage = employees.wagerate * hourcount
  2843.           next
  2844.        next
  2845.        '.................print the wages list
  2846.        for wagelist with worksno in order
  2847.           print list items
  2848.        next
  2849.  
  2850.        This procedure starts by erasing the present contents of the
  2851.        "wagelist" form. It then selects each record from the
  2852.        "employees" form, counts all entries in the "timesheet" form
  2853.        for the employee and enters a new record in the "wagelist"
  2854.        form. Finally it prints the new wage list.
  2855.  
  2856.  
  2857.  
  2858.  
  2859.  
  2860.  
  2861.                                  - 47 -
  2862. ................................................................................
  2863.        FOR..NEXT            ˇˇPROCEDURE COMMAND   ˇˇˇˇˇˇˇˇˇˇˇFOR..NEXT
  2864.  
  2865.        Occasionally you may need to nest a "For" loop of a form within
  2866.        another "For" loop of the same form. If you do this, then in
  2867.        order to differentiate between the fields in the outer and
  2868.        inner loops you must allocate an "alias" name to the form in
  2869.        one of the loops. When you allocate an alias to a form name
  2870.        then all the fields of the form can also be referenced by the
  2871.        alias name.
  2872.  
  2873.        Ex.
  2874.        .......................procedure code...........
  2875.        declare output fields
  2876.           males : females : pupils.age
  2877.        end
  2878.        for pupils with age in order unique
  2879.           males = 0 : females = 0
  2880.           for pupils alias agegroups with age = pupils.age
  2881.              if agegroups.sex = "male" then
  2882.                 males = males + 1
  2883.              else
  2884.                 females = females + 1
  2885.              end if
  2886.           next
  2887.           print list items
  2888.        next
  2889.        ....................output format......................
  2890.        .list items
  2891.        There are {males} males and {females} females aged {pupils.age}
  2892.        .end
  2893.  
  2894.  
  2895.        This example counts and prints the number of male and female
  2896.        pupils in each age group.
  2897.  
  2898.        If you intend to print fields from one of the nested loops as
  2899.        the "Age" field above then you should give the alias name to
  2900.        the other loop. You can only declare an output field with the
  2901.        real form name. If you have to print fields from both loops
  2902.        then you must declare an "Ad Hoc" field and pass the alias
  2903.        fields contents to it for printing.
  2904.  
  2905.        If you need to exclude individual or groups of records from
  2906.        selection just use the "Skip Record" or "Skip Group" command.
  2907.  
  2908.        Ex.
  2909.  
  2910.        for videos with category in order
  2911.           if videos.category = "Cartoon" then skip group
  2912.           print list items
  2913.        next
  2914.  
  2915.  
  2916.  
  2917.  
  2918.                                  - 48 -
  2919. ................................................................................
  2920.        FORM LETTERS         ˇˇˇˇˇˇˇMETHOD         ˇˇˇˇˇˇˇˇFORM LETTERS
  2921.  
  2922.        To print form letters (circulars) with a different address and
  2923.        salutation for each entry in an address form simply type the
  2924.        entire letter between the .List Items and .End of the output
  2925.        format.
  2926.  
  2927.        .........................procedure code........
  2928.        Declare output fields
  2929.           Addr.name : Addr.street : Addr.town
  2930.           Addr.salutation
  2931.           date
  2932.        end
  2933.        date = datetext(system date)
  2934.        for addr
  2935.           print list items
  2936.           page feed
  2937.        next
  2938.  
  2939.        .........................output format........
  2940.        .List Items
  2941.                                               My street
  2942.                                               My county
  2943.                                               {date field  }
  2944.  
  2945.  
  2946.        {Addr.name field    }
  2947.        {Addr.street field  }
  2948.        {Addr.town field    }
  2949.  
  2950.  
  2951.        Dear {Addr.salutation},
  2952.  
  2953.            You are invited................................
  2954.        ...................................................
  2955.        ...................................................
  2956.        ..........................................
  2957.  
  2958.        Yours faithfully,
  2959.  
  2960.  
  2961.  
  2962.        Fred A Blogs
  2963.        .End
  2964.  
  2965.        Although this is the fastest way to produce a short form
  2966.        letter, the Format Editor is not the nicest place to write
  2967.        text. If you want the benefits of word wrap and spell checking
  2968.        then you can create a form in which to write the letter. Create
  2969.        text block fields to hold a page of text and a name field so
  2970.        that you can store many different letters and print them with
  2971.        the same procedure. If your letters are to be more than one
  2972.        page long then put the same name on each page.
  2973.  
  2974.  
  2975.                                  - 49 -
  2976. ................................................................................
  2977.        FORM LETTERS         ˇˇˇˇˇˇˇMETHOD         ˇˇˇˇˇˇˇˇFORM LETTERS
  2978.  
  2979.        To print the form letters from the "Letters" form your
  2980.        procedure must now have an input screen which looks up the name
  2981.        of the letter to be printed.
  2982.  
  2983.        '............................CODE.....................
  2984.        declare output fields
  2985.           addr.name : addr.street : addr.town :addr.salutation
  2986.           date :letters.block1 :letters.block2 :letters.block3
  2987.        end
  2988.        declare variables
  2989.           page as number
  2990.        end
  2991.        date = datetext(system date)
  2992.        for addr
  2993.           page = 0
  2994.           for letters with name = input.name
  2995.              page = page + 1
  2996.              if page = 1 then print list items
  2997.              if page > 1 then print extra
  2998.              page feed
  2999.           next
  3000.        next
  3001.  
  3002.        The output format is similar to that shown on the previous page
  3003.        but the text in the .list items section is replaced by the text
  3004.        block fields Letters.block1 ,letters.block2 and letters.block3
  3005.        and an additional section .extra is added which has the same
  3006.        text block fields but no address or salutation.
  3007.  
  3008.  
  3009.  
  3010.  
  3011.  
  3012.  
  3013.  
  3014.  
  3015.  
  3016.  
  3017.  
  3018.  
  3019.  
  3020.  
  3021.  
  3022.  
  3023.  
  3024.  
  3025.  
  3026.  
  3027.  
  3028.  
  3029.  
  3030.  
  3031.  
  3032.                                  - 50 -
  3033. ................................................................................
  3034.        FORMATTED TEXT       ˇˇˇˇˇFIELD TYPE       ˇˇˇˇˇˇFORMATTED TEXT
  3035.  
  3036.        If you define a field with the type "formatted text" a window
  3037.        opens up in which you enter the formatting characters. The
  3038.        characters which are to be entered by the user are shown as
  3039.        question marks. Any other characters which you enter become
  3040.        permanent fixtures in the field. The "formatted text" field can
  3041.        be up to twenty characters long and can be used for dates,
  3042.        national insurance numbers etc.
  3043.  
  3044.        Formatted text fields should not be derived.
  3045.  
  3046.  
  3047.  
  3048.  
  3049.  
  3050.  
  3051.  
  3052.  
  3053.  
  3054.  
  3055.  
  3056.  
  3057.  
  3058.  
  3059.  
  3060.  
  3061.  
  3062.  
  3063.  
  3064.  
  3065.  
  3066.  
  3067.  
  3068.  
  3069.  
  3070.  
  3071.  
  3072.  
  3073.  
  3074.  
  3075.  
  3076.  
  3077.  
  3078.  
  3079.  
  3080.  
  3081.  
  3082.  
  3083.  
  3084.  
  3085.  
  3086.  
  3087.  
  3088.  
  3089.                                  - 51 -
  3090. ................................................................................
  3091.        GLOBAL NUMBER        ˇˇˇˇSYSTEM VALUE      ˇˇˇˇˇˇˇGLOBAL NUMBER
  3092.  
  3093.        The variables you create in Easy Base procedures are local
  3094.        variables - they cease to exist when the procedure ends. So
  3095.        that you can pass messages between procedures Easy base
  3096.        provides a single global variable "Global Number".  Once you
  3097.        allocate a value to "Global Number" that value remains
  3098.        unchanged (even if your computer has been turned off) until you
  3099.        allocate another value to it. You can of course pass many
  3100.        messages between procedures simply by entering records in forms
  3101.        and re-reading them but using "Global Number" is much quicker.
  3102.  
  3103.        The following example uses "Global Number" to make access to a
  3104.        user menu restricted by password.
  3105.  
  3106.        Two procedures are defined. The first, "getpassword" has a
  3107.        password field on its input screen and the following code:-
  3108.  
  3109.        if input.password = "gingerbread" then
  3110.           global number = 1
  3111.        else
  3112.           global number = 0
  3113.        end if
  3114.  
  3115.        The second procedure "checkpassword" has the following code:-
  3116.  
  3117.        if global number <> 1 then exit batch menu
  3118.        global number = 0
  3119.  
  3120.        The open access menu system has an item for the restricted menu
  3121.        but instead of calling it direct it calls the menu "Password"
  3122.        which is a batch execute menu with the items
  3123.  
  3124.        run procedure ----  getpassword
  3125.        run procedure ----  checkpassword
  3126.        user menu     ----  restricted
  3127.  
  3128.        If the password "gingerbread" has not been entered in the
  3129.        "getpassword" input screen then "checkpassword" will return
  3130.        control to the original menu.
  3131.  
  3132.  
  3133.  
  3134.  
  3135.  
  3136.  
  3137.  
  3138.  
  3139.  
  3140.  
  3141.  
  3142.  
  3143.  
  3144.  
  3145.  
  3146.                                  - 52 -
  3147. ................................................................................
  3148.        GOTO (FIELD) NEXT    ˇˇDERIVATION PREFIX   ˇˇˇGOTO (FIELD) NEXT
  3149.  
  3150.        In an Easy Base form or procedure input screen the cursor moves
  3151.        from field to field in the default order top left to bottom
  3152.        right when you press the Return key. You can alter this default
  3153.        order by deriving any field with "Goto (fieldname) next". If
  3154.        the field from which you wish to redirect the cursor already
  3155.        has a derivation formula you simply add the "Goto - Next" as a
  3156.        prefix.
  3157.  
  3158.        Ex.
  3159.  
  3160.        goto price next
  3161.  
  3162.        goto item next default(lookup(stock,name))
  3163.  
  3164.        Cursor redirection with the "Goto - next" derivation only
  3165.        occurs when the Return key is pressed it is not activated if
  3166.        you move the cursor with the directional arrow keys.
  3167.  
  3168.  
  3169.        Note: You can only have one prefix on any one field derivation.
  3170.  
  3171.  
  3172.  
  3173.  
  3174.  
  3175.  
  3176.  
  3177.  
  3178.  
  3179.  
  3180.  
  3181.  
  3182.  
  3183.  
  3184.  
  3185.  
  3186.  
  3187.  
  3188.  
  3189.  
  3190.  
  3191.  
  3192.  
  3193.  
  3194.  
  3195.  
  3196.  
  3197.  
  3198.  
  3199.  
  3200.  
  3201.  
  3202.  
  3203.                                  - 53 -
  3204. ................................................................................
  3205.        HOURS                ˇˇˇˇˇˇFUNCTION        ˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇHOURS
  3206.  
  3207.        This function returns the hour ( 1 to 23) of the time parameter
  3208.  
  3209.        Ex.  Hour(system time)
  3210.  
  3211.        Ex.
  3212.  
  3213.        Labourcharge = (hours(endtime)-hours(starttime))* rate
  3214.  
  3215.  
  3216.        Acceptable parameters:
  3217.  
  3218.        System time
  3219.        Time field
  3220.        Maketime function
  3221.        Time expression
  3222.  
  3223.  
  3224.  
  3225.  
  3226.  
  3227.  
  3228.  
  3229.  
  3230.  
  3231.  
  3232.  
  3233.  
  3234.  
  3235.  
  3236.  
  3237.  
  3238.  
  3239.  
  3240.  
  3241.  
  3242.  
  3243.  
  3244.  
  3245.  
  3246.  
  3247.  
  3248.  
  3249.  
  3250.  
  3251.  
  3252.  
  3253.  
  3254.  
  3255.  
  3256.  
  3257.  
  3258.  
  3259.  
  3260.                                  - 54 -
  3261. ................................................................................
  3262.        IF                   ˇˇˇˇˇˇFUNCTION        ˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇIF
  3263.  
  3264.        Ex.  if(num >= 0,"Positive","negative")
  3265.  
  3266.        The first parameter of the "if" function is an expression, the
  3267.        second is the value to be returned if the expression is true
  3268.        and the third is the value to be returned if the expression is
  3269.        false.
  3270.  
  3271.        If the third parameter is omitted and the expression is false
  3272.        then the field or variable retains any value it had before the
  3273.        function was called.
  3274.  
  3275.        The "if" function can be extended to a full "case" function
  3276.        simply by adding more expressions and return values.
  3277.  
  3278.        Ex.  if(num > 0,"Positive",num = 0,"Zero","Negative")
  3279.  
  3280.        There is no limit to the number of expressions and return
  3281.        values. If more than one expression is true the value returned
  3282.        is that for the first true expression. If none are true then
  3283.        the trailing value is returned as the "case else".
  3284.  
  3285.        Acceptable Parameters:
  3286.  
  3287.        Numeric expressions
  3288.        Quoted text
  3289.        Fields and variables
  3290.        Other nested functions
  3291.        System Values
  3292.  
  3293.  
  3294.  
  3295.  
  3296.  
  3297.  
  3298.  
  3299.  
  3300.  
  3301.  
  3302.  
  3303.  
  3304.  
  3305.  
  3306.  
  3307.  
  3308.  
  3309.  
  3310.  
  3311.  
  3312.  
  3313.  
  3314.  
  3315.  
  3316.  
  3317.                                  - 55 -
  3318. ................................................................................
  3319.        IF THEN ELSE         ˇˇPROCEDURE COMMAND   ˇˇˇˇˇˇˇˇIF THEN ELSE
  3320.  
  3321.        Easy Base recognizes the following "If Then Else"
  3322.        constructions.
  3323.  
  3324.        1.    if (condition) then (action)
  3325.              ------------------------------------------
  3326.        2.    if (condition) then (action) else (action)
  3327.              ------------------------------------------
  3328.        3.    if (condition) then
  3329.                 (action)
  3330.                 (action)
  3331.                 (action)
  3332.              end if
  3333.              -----------------------------------------
  3334.        4.    if (condition) then
  3335.                 (action)
  3336.                 (action)
  3337.              else
  3338.                 (action)
  3339.                 (action)
  3340.              end if
  3341.  
  3342.        If then constructions can be nested to any depth.
  3343.  
  3344.        if (condition) and (condition) then
  3345.           (action)
  3346.           if (condition) or (condition) then
  3347.              (action)
  3348.              (action)
  3349.           else
  3350.              (action)
  3351.              if (condition) eqv (condition) then (action)
  3352.              (action)
  3353.           end if
  3354.           if (condition) then (action)
  3355.        else
  3356.           (action)
  3357.        end if
  3358.  
  3359.        Easy base does not interpret "Else if" constructions.
  3360.  
  3361.        Easy base does not interpret two "if" conditions on one line.
  3362.  
  3363.  
  3364.        In the above examples "action" applies to any Easy base command
  3365.        or full "Do Loop" or full "For Next" structure.
  3366.  
  3367.        You cannot split a "Do Loop" structure and you can only split a
  3368.        "For Next" structure by a simple "If then" and "End if" with no
  3369.        "else" command.
  3370.  
  3371.        Ex. on next page.
  3372.  
  3373.  
  3374.                                  - 56 -
  3375. ................................................................................
  3376.        IF THEN ELSE         ˇˇPROCEDURE COMMAND   ˇˇˇˇˇˇˇˇIF THEN ELSE
  3377.  
  3378.        In the following example the procedure has an input screen with
  3379.        a field "type". "type" is a choice field with the choices "In
  3380.        age order", "In alphabetic order" and "By sex". The procedure
  3381.        code selects one of three listings from the "Pupils" form by
  3382.        splitting "For Next" structures by "If Then" structures.
  3383.  
  3384.        if input.type = "in age order" then
  3385.           for pupils with age in order
  3386.        end if
  3387.        if input.type = "in alphabetic order" then
  3388.           for pupils with name in order
  3389.        end if
  3390.        if input.type = "by sex" then
  3391.           for pupils with sex in order
  3392.        end if
  3393.           print list items
  3394.        next
  3395.        next
  3396.        next
  3397.  
  3398.        The structure above is the only one in which "For Next"
  3399.        structures can be split. There must be a separate "If Then"
  3400.        followed by "End If" for each "For". There must be a "Next for
  3401.        each "For"  and there cannot be an "Else" anywhere in the
  3402.        construction.
  3403.  
  3404.  
  3405.  
  3406.  
  3407.  
  3408.  
  3409.  
  3410.  
  3411.  
  3412.  
  3413.  
  3414.  
  3415.  
  3416.  
  3417.  
  3418.  
  3419.  
  3420.  
  3421.  
  3422.  
  3423.  
  3424.  
  3425.  
  3426.  
  3427.  
  3428.  
  3429.  
  3430.  
  3431.                                  - 57 -
  3432. ................................................................................
  3433.        INDEX OFF            ˇˇPROCEDURE COMMAND   ˇˇˇˇˇˇˇˇˇˇˇINDEX OFF
  3434.  
  3435.        When an Easy Base procedure adds, updates or deletes a record
  3436.        then by default it updates any affected index files. As the
  3437.        majority of transaction procedures act on a single record this
  3438.        is the fastest method of processing. It does of course require
  3439.        that the form is periodically re-packed.  If, however, a
  3440.        procedure is to add, update or delete many records then
  3441.        updating each affected index file on each iteration of the
  3442.        "For" loop can be much slower than ignoring the indices during
  3443.        the loop and re-writing them from scratch afterward.
  3444.  
  3445.        You can take the "re-write" option by issuing the command
  3446.        "Index off" before the "For" loop.
  3447.  
  3448.        index off
  3449.        for employees
  3450.          for wagelist new record
  3451.             wagelist.worksno = employees.worksno
  3452.             wagelist.taxcode = employees.taxcode
  3453.          next
  3454.        next
  3455.  
  3456.        Obviously re-writing an entire index file when only one or two
  3457.        records are affected would be slower than simply updating the
  3458.        indices. The actual point at which "Index Off" becomes faster
  3459.        can only be determined by trial but as a general rule the two
  3460.        systems take equal time when between 12 and 15 percent of the
  3461.        records of a file are affected and the advantage of "Index Off"
  3462.        becomes greater the bigger this percentage.
  3463.  
  3464.        There is no corresponding "Index On" command. Indexing is
  3465.        turned back on automatically and the index files are re-written
  3466.        at the end of the loop to which the command applies. If you
  3467.        require indexing off during more than one loop you must issue
  3468.        the command before each.
  3469.  
  3470.        index off
  3471.        for invoices with date < makedate(05,04,93)
  3472.           delete records
  3473.        next
  3474.        index off
  3475.        for invoices with customer = "john smith"
  3476.           invoices.customer = "John Smith Ltd"
  3477.           update record
  3478.        next
  3479.  
  3480.        If you prefix a loop which deletes records from a form then the
  3481.        form is packed at the end of the loop.
  3482.  
  3483.  
  3484.  
  3485.  
  3486.  
  3487.  
  3488.                                  - 58 -
  3489. ................................................................................
  3490.        INSTALL FORM         ˇˇˇˇˇˇUTILITY         ˇˇˇˇˇˇˇˇINSTALL FORM
  3491.  
  3492.        The "Install Form" utility is accessed from the Utilities menu.
  3493.        If you wish to include a form in one application which you
  3494.        designed in another then you cannot simply copy the files to
  3495.        the new applications directory as there will be no entry in the
  3496.        "Forms Directory" file.
  3497.  
  3498.        To install a form from another application - first get the
  3499.        forms DOS filename from that application then select "Install
  3500.        Form" from the utilities menu. You will be asked to supply the
  3501.        forms name and the full path and filename from where it is to
  3502.        be copied. Easy Base will then copy the forms definition file
  3503.        and make the appropriate entry in the "Forms Directory". It
  3504.        will then ask whether or not you wish the data to be copied
  3505.        from the original application.
  3506.  
  3507.        If you install a form from another application and it has
  3508.        "lookup" derivations or Choice List fields then you will have
  3509.        to create the relationships and choice lists in the new
  3510.        application. They are not automatically reproduced.
  3511.  
  3512.  
  3513.  
  3514.  
  3515.  
  3516.  
  3517.  
  3518.  
  3519.  
  3520.  
  3521.  
  3522.  
  3523.  
  3524.  
  3525.  
  3526.  
  3527.  
  3528.  
  3529.  
  3530.  
  3531.  
  3532.  
  3533.  
  3534.  
  3535.  
  3536.  
  3537.  
  3538.  
  3539.  
  3540.  
  3541.  
  3542.  
  3543.  
  3544.  
  3545.                                  - 59 -
  3546. ................................................................................
  3547.        INSTALL PRINTER      ˇˇˇˇˇˇUTILITY         ˇˇˇˇˇINSTALL PRINTER
  3548.  
  3549.        The "Install printer" utility is accessed from the Utilities
  3550.        menu. It can also be included in a user menu so that end users
  3551.        of finished applications can install their printer without
  3552.        access to the system menus.
  3553.  
  3554.        When you select "Install Printer" you are offered a choice of
  3555.        ten printer drivers - five for named printers and five generic
  3556.        drivers. The drivers supplied cover virtually all printers
  3557.        except daisy wheels.
  3558.  
  3559.        When you have chosen your printer driver Easy Base then asks
  3560.        for the parallel port number to which printer output is to be
  3561.        sent - one or two. Easy Base does not have a built in serial
  3562.        port printer output. If your printer only has a serial input
  3563.        then you must redirect a parallel port with the DOS "Mode"
  3564.        command.
  3565.  
  3566.        Easy Base then asks how much paper wastage there is at the top
  3567.        of the page. This is quite important as it is used in
  3568.        conjunction with the paper size in use to determine the
  3569.        "Bottom Margin" value, used for pagination in printed reports.
  3570.  
  3571.        You are then asked for the wastage at the left margin. This
  3572.        information is used in the format editor to display the right
  3573.        edge of the paper at the different print sizes. There are only
  3574.        two settings for wastage at the left margin - zero and ¨ inch.
  3575.        If you have a cartridge fed printer such as a Laser or Bubble
  3576.        Jet then it will almost certainly be ¨ inch. If you have a
  3577.        traction or manual feed then you will be able to adjust the
  3578.        left margin and you should set it to zero.
  3579.  
  3580.        Finally you are asked for the top margin required in printed
  3581.        reports. This can only be between the value set as the printers
  3582.        inherent wastage and one inch.  The value you set here will be
  3583.        the default top margin for all printouts. If you need a larger
  3584.        top margin for certain printouts then you must include blank
  3585.        lines in the page header of the procedures output format.
  3586.  
  3587.  
  3588.  
  3589.  
  3590.  
  3591.  
  3592.  
  3593.  
  3594.  
  3595.  
  3596.  
  3597.  
  3598.  
  3599.  
  3600.  
  3601.  
  3602.                                  - 60 -
  3603. ................................................................................
  3604.        INSTALL PROCEDURE    ˇˇˇˇˇˇUTILITY         ˇˇˇINSTALL PROCEDURE
  3605.  
  3606.        The "Install procedure" utility is accessed from the
  3607.        Utilities menu and allows you to install procedures which you
  3608.        designed in another application. It is used exactly like the
  3609.        "Install Form" utility previously described.
  3610.  
  3611.  
  3612.  
  3613.  
  3614.  
  3615.  
  3616.  
  3617.  
  3618.  
  3619.  
  3620.  
  3621.  
  3622.  
  3623.  
  3624.  
  3625.  
  3626.  
  3627.  
  3628.  
  3629.  
  3630.  
  3631.  
  3632.  
  3633.  
  3634.  
  3635.  
  3636.  
  3637.  
  3638.  
  3639.  
  3640.  
  3641.  
  3642.  
  3643.  
  3644.  
  3645.  
  3646.  
  3647.  
  3648.  
  3649.  
  3650.  
  3651.  
  3652.  
  3653.  
  3654.  
  3655.  
  3656.  
  3657.  
  3658.  
  3659.                                  - 61 -
  3660. ................................................................................
  3661.        INTEGER              ˇˇˇˇˇFIELD TYPE       ˇˇˇˇˇˇˇˇˇˇˇˇˇINTEGER
  3662.  
  3663.        Integer fields can have up to 14 digits and use a comma as the
  3664.        thousands separator.
  3665.  
  3666.        Although integer fields display integers they store the result
  3667.        of any division correct to 15 significant figures.
  3668.  
  3669.        See - Operators Arithmetic
  3670.  
  3671.  
  3672.  
  3673.  
  3674.  
  3675.  
  3676.  
  3677.  
  3678.  
  3679.  
  3680.  
  3681.  
  3682.  
  3683.  
  3684.  
  3685.  
  3686.  
  3687.  
  3688.  
  3689.  
  3690.  
  3691.  
  3692.  
  3693.  
  3694.  
  3695.  
  3696.  
  3697.  
  3698.  
  3699.  
  3700.  
  3701.  
  3702.  
  3703.  
  3704.  
  3705.  
  3706.  
  3707.  
  3708.  
  3709.  
  3710.  
  3711.  
  3712.  
  3713.  
  3714.  
  3715.  
  3716.                                  - 62 -
  3717. ................................................................................
  3718.        INTEXT               ˇˇˇˇˇˇFUNCTION        ˇˇˇˇˇˇˇˇˇˇˇˇˇˇINTEXT
  3719.  
  3720.        This function returns the starting character number of one
  3721.        length of text within another.
  3722.  
  3723.        Ex.    Intext(companyname," and ")
  3724.               < Returns 7 if companyname = "Turner and Smith"
  3725.  
  3726.        The intext function returns 0 if the second parameter is not
  3727.        found in the first.
  3728.  
  3729.        Ex.
  3730.  
  3731.        If intext(customers.companyname," Ltd") <> 0 then
  3732.           customers.Ltd  = "yes"
  3733.           update record
  3734.        end if
  3735.  
  3736.        Acceptable parameters:
  3737.  
  3738.        Text field/variable
  3739.        Any function returning a text value
  3740.  
  3741.  
  3742.  
  3743.  
  3744.  
  3745.  
  3746.  
  3747.  
  3748.  
  3749.  
  3750.  
  3751.  
  3752.  
  3753.  
  3754.  
  3755.  
  3756.  
  3757.  
  3758.  
  3759.  
  3760.  
  3761.  
  3762.  
  3763.  
  3764.  
  3765.  
  3766.  
  3767.  
  3768.  
  3769.  
  3770.  
  3771.  
  3772.  
  3773.                                  - 63 -
  3774. ................................................................................
  3775.        JOINTEXT             ˇˇˇˇˇˇFUNCTION        ˇˇˇˇˇˇˇˇˇˇˇˇJOINTEXT
  3776.  
  3777.        Ex.  Jointext(forename,surname)
  3778.  
  3779.        The jointext function takes any number of parameters.
  3780.  
  3781.        Ex.  Jointext("Mr ",forename," ",surname," Esq.")
  3782.        Ex.  Jointext(if(sex=male,"Mr ","Ms "),surname)
  3783.  
  3784.        The "jointext" function will also perform any arithmetic
  3785.        operations required for a text output.
  3786.  
  3787.        Ex. Jointext("The Gross price is ",netprice *120/100)
  3788.  
  3789.        The "jointext" function is also used for creating compound
  3790.        index fields.
  3791.  
  3792.        Ex. Jointext(reverse(zeropad(price,4,2)),stockitem)
  3793.  
  3794.        This creates a field whose index allows a stock file to be
  3795.        listed with stockitem in alphabetical order but grouped by
  3796.        price in reverse order.
  3797.  
  3798.        If you "Jointext" a date or time field you will get the date or
  3799.        time's numeric value not the date or time's string
  3800.        representation. (See Compound Index)
  3801.  
  3802.        By default the "Jointext" function strips trailing blank space
  3803.        characters from the texts being joined. If you wish to join
  3804.        text in a Text Block field so that the second text starts on a
  3805.        new line then you can force this by including Chr$(13) which
  3806.        Easy base uses as a "New Line" flag.
  3807.  
  3808.        Ex.
  3809.  
  3810.            Jointext(block1,chr$(13),block2)
  3811.  
  3812.            <The text from block2 will start on a new line>
  3813.  
  3814.        Ex.
  3815.  
  3816.            Jointext(block1,chr$(13),chr$(13),block2)
  3817.  
  3818.           <There will be a blank line between block1 and block2>
  3819.  
  3820.        Acceptable Parameters:
  3821.  
  3822.        Numeric expressions
  3823.        Quoted text
  3824.        Fields and variables
  3825.        Other nested functions
  3826.        System Values
  3827.  
  3828.  
  3829.  
  3830.                                  - 64 -
  3831. ................................................................................
  3832.        LEFTTEXT             ˇˇˇˇˇˇFUNCTION        ˇˇˇˇˇˇˇˇˇˇˇˇLEFTTEXT
  3833.  
  3834.        This function returns a specified number of characters from the
  3835.        start of a field or variable.
  3836.  
  3837.        Ex.   Lefttext(salutation,2)
  3838.              < returns "Mr" from "Mr Smith" or "Ms" from "Ms Smith"
  3839.  
  3840.        Ex.   Lefttext(datetext(system date),4)
  3841.              < Returns 12th , 20th Etc.>   (European date format)
  3842.  
  3843.  
  3844.  
  3845.  
  3846.        Acceptable parameters:
  3847.  
  3848.        Text field/variable
  3849.        Any function returning a text value
  3850.  
  3851.  
  3852.  
  3853.  
  3854.  
  3855.  
  3856.  
  3857.  
  3858.  
  3859.  
  3860.  
  3861.  
  3862.  
  3863.  
  3864.  
  3865.  
  3866.  
  3867.  
  3868.  
  3869.  
  3870.  
  3871.  
  3872.  
  3873.  
  3874.  
  3875.  
  3876.  
  3877.  
  3878.  
  3879.  
  3880.  
  3881.  
  3882.  
  3883.  
  3884.  
  3885.  
  3886.  
  3887.                                  - 65 -
  3888. ................................................................................
  3889.        LENGTHTEXT           ˇˇˇˇˇˇFUNCTION        ˇˇˇˇˇˇˇˇˇˇLENGTHTEXT
  3890.  
  3891.        This function returns the length of text in a field or variable
  3892.  
  3893.        Ex.   lengthtext(name)
  3894.              < Returns 4 if name = "Bill"  10 if name = "Bill Smith"
  3895.  
  3896.  
  3897.        Acceptable parameters:
  3898.  
  3899.        Text field/variable
  3900.        Any function returning a text value
  3901.  
  3902.  
  3903.  
  3904.  
  3905.  
  3906.  
  3907.  
  3908.  
  3909.  
  3910.  
  3911.  
  3912.  
  3913.  
  3914.  
  3915.  
  3916.  
  3917.  
  3918.  
  3919.  
  3920.  
  3921.  
  3922.  
  3923.  
  3924.  
  3925.  
  3926.  
  3927.  
  3928.  
  3929.  
  3930.  
  3931.  
  3932.  
  3933.  
  3934.  
  3935.  
  3936.  
  3937.  
  3938.  
  3939.  
  3940.  
  3941.  
  3942.  
  3943.  
  3944.                                  - 66 -
  3945. ................................................................................
  3946.        LIST FILE NAMES      ˇˇˇˇˇˇUTILITY         ˇˇˇˇˇLIST FILE NAMES
  3947.  
  3948.        When you give a name to a Form or Procedure in Easy Base it is
  3949.        not the actual DOS file name used. A Form has separate DOS
  3950.        files for its definition, its data and its indices. Similarly a
  3951.        procedure can have one or two files depending on whether or not
  3952.        it has an input screen. Within an application you never need to
  3953.        know the DOS filenames as Easy Base takes care of all disk
  3954.        activity in the background.
  3955.  
  3956.        You may however need to know the DOS filenames if you intend to
  3957.        export data to another program or copy a Form or Procedure from
  3958.        one application to another.
  3959.  
  3960.        You can list the DOS filenames for Forms and reports with the
  3961.        "List File Names" utility.
  3962.  
  3963.        The "List File Names" utility can also be called from a user
  3964.        menu without accessing the system.
  3965.  
  3966.  
  3967.  
  3968.  
  3969.  
  3970.  
  3971.  
  3972.  
  3973.  
  3974.  
  3975.  
  3976.  
  3977.  
  3978.  
  3979.  
  3980.  
  3981.  
  3982.  
  3983.  
  3984.  
  3985.  
  3986.  
  3987.  
  3988.  
  3989.  
  3990.  
  3991.  
  3992.  
  3993.  
  3994.  
  3995.  
  3996.  
  3997.  
  3998.  
  3999.  
  4000.  
  4001.                                  - 67 -
  4002. ................................................................................
  4003.        LIST VARIABLES       ˇˇPROCEDURE COMMAND   ˇˇˇˇˇˇLIST VARIABLES
  4004.  
  4005.        The "List Variables" command is a de-bugging facility for
  4006.        developers. If a procedure is not producing the expected
  4007.        results you can interrupt it at any point and view the contents
  4008.        of all fields and variables in memory at that point.
  4009.  
  4010.        Ex.
  4011.  
  4012.        for authors with surname in order
  4013.           if authors.surname = "kippling" then list variables
  4014.           for books with author = authors.surname
  4015.              print list items
  4016.           next
  4017.        next
  4018.  
  4019.  
  4020.  
  4021.  
  4022.  
  4023.  
  4024.  
  4025.  
  4026.  
  4027.  
  4028.  
  4029.  
  4030.  
  4031.  
  4032.  
  4033.  
  4034.  
  4035.  
  4036.  
  4037.  
  4038.  
  4039.  
  4040.  
  4041.  
  4042.  
  4043.  
  4044.  
  4045.  
  4046.  
  4047.  
  4048.  
  4049.  
  4050.  
  4051.  
  4052.  
  4053.  
  4054.  
  4055.  
  4056.  
  4057.  
  4058.                                  - 68 -
  4059. ................................................................................
  4060.        LOOKUP               ˇˇˇˇˇˇFUNCTION        ˇˇˇˇˇˇˇˇˇˇˇˇˇˇLOOKUP
  4061.  
  4062.        Ex. Lookup(customers,name)
  4063.  
  4064.        The first parameter is the name of a relationship defined in
  4065.        the relationships form. The second parameter is the name of the
  4066.        field in the secondary file whose value is to be looked up. The
  4067.        parameters are absolute. You cannot supply them as variables
  4068.        fields or the results of other functions.
  4069.  
  4070.        Unlike other functions, "lookup" can only be used in a field
  4071.        derivation, entry conditions and mandatory conditions. It has
  4072.        no meaning in the procedure language.
  4073.  
  4074.        A full description of how to use the Lookup function is given
  4075.        in the users manual
  4076.  
  4077.        Acceptable parameters
  4078.  
  4079.        1.   Relationship name
  4080.        2.   Field Name
  4081.  
  4082.  
  4083.  
  4084.  
  4085.  
  4086.  
  4087.  
  4088.  
  4089.  
  4090.  
  4091.  
  4092.  
  4093.  
  4094.  
  4095.  
  4096.  
  4097.  
  4098.  
  4099.  
  4100.  
  4101.  
  4102.  
  4103.  
  4104.  
  4105.  
  4106.  
  4107.  
  4108.  
  4109.  
  4110.  
  4111.  
  4112.  
  4113.  
  4114.  
  4115.                                  - 69 -
  4116. ................................................................................
  4117.        LOWER                ˇˇˇˇˇˇFUNCTION        ˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇLOWER
  4118.  
  4119.        Returns the lower case of the parameter.
  4120.  
  4121.        Ex. lower(partname)
  4122.  
  4123.  
  4124.        Ex.
  4125.  
  4126.        Heading = Jointext("List of parts supplied by ",lower(makers.
  4127.        name))
  4128.  
  4129.  
  4130.        Acceptable parameters:
  4131.  
  4132.        Quoted text
  4133.        Text Field/variable
  4134.  
  4135.  
  4136.  
  4137.  
  4138.  
  4139.  
  4140.  
  4141.  
  4142.  
  4143.  
  4144.  
  4145.  
  4146.  
  4147.  
  4148.  
  4149.  
  4150.  
  4151.  
  4152.  
  4153.  
  4154.  
  4155.  
  4156.  
  4157.  
  4158.  
  4159.  
  4160.  
  4161.  
  4162.  
  4163.  
  4164.  
  4165.  
  4166.  
  4167.  
  4168.  
  4169.  
  4170.  
  4171.  
  4172.                                  - 70 -
  4173. ................................................................................
  4174.        MAKEDATE             ˇˇˇˇˇˇFUNCTION        ˇˇˇˇˇˇˇˇˇˇˇˇMAKEDATE
  4175.  
  4176.        The Easy base Date field is a six digit field which covers the
  4177.        century from 1 Jan 1981 to 31 Dec 2080 and upon which you can
  4178.        perform addition and subtraction operations in days.
  4179.  
  4180.        Ex. Duedate = Invoicedate + 30
  4181.  
  4182.        In order to provide this facility the date is held as a numeric
  4183.        value. You can only type a date directly into a date field.
  4184.  
  4185.        If you need to enter a date in a derivation or in a procedure
  4186.        code you must use the "makedate" function.
  4187.  
  4188.        Ex.  Makedate(5,11,95)
  4189.            < Returns 05/11/95 >
  4190.  
  4191.        Ex.  Nextmonth = month(system date)+1
  4192.             if nextmonth = 13 then nextmonth = 1
  4193.             Nextdelivery = makedate(1,nextmonth,year(system date))
  4194.             < Returns the date of the first of next month >
  4195.  
  4196.        Acceptable parameters
  4197.  
  4198.        Numeric value
  4199.        Numeric expression
  4200.        Numeric field/variable
  4201.        Any other function which returns a numeric value
  4202.  
  4203.  
  4204.  
  4205.  
  4206.  
  4207.  
  4208.  
  4209.  
  4210.  
  4211.  
  4212.  
  4213.  
  4214.  
  4215.  
  4216.  
  4217.  
  4218.  
  4219.  
  4220.  
  4221.  
  4222.  
  4223.  
  4224.  
  4225.  
  4226.  
  4227.  
  4228.  
  4229.                                  - 71 -
  4230. ................................................................................
  4231.        MAKETIME             ˇˇˇˇˇˇFUNCTION        ˇˇˇˇˇˇˇˇˇˇˇˇMAKETIME
  4232.  
  4233.        The value of a time field in Easy base is held as a numeric
  4234.        value representing the number of seconds past midnight. This
  4235.        allows you to perform addition and subtraction operations in
  4236.        seconds.
  4237.  
  4238.        Ex. Timetaken = Round(Endtime - Starttime / 60)
  4239.            < This returns the time taken in minutes >
  4240.  
  4241.        You can only enter a time directly into a time field.
  4242.  
  4243.        If you need to enter a time in a field derivation or in a
  4244.        procedure code you must use the "Maketime" function.
  4245.  
  4246.        Ex. Time = Maketime(20,20,00)
  4247.             <  returns 20:20:00  >
  4248.  
  4249.  
  4250.        Acceptable parameters:
  4251.  
  4252.        Numeric value
  4253.        Numeric expression
  4254.        Numeric field/variable
  4255.        Any other function which returns a numeric value
  4256.  
  4257.  
  4258.  
  4259.  
  4260.  
  4261.  
  4262.  
  4263.  
  4264.  
  4265.  
  4266.  
  4267.  
  4268.  
  4269.  
  4270.  
  4271.  
  4272.  
  4273.  
  4274.  
  4275.  
  4276.  
  4277.  
  4278.  
  4279.  
  4280.  
  4281.  
  4282.  
  4283.  
  4284.  
  4285.  
  4286.                                  - 72 -
  4287. ................................................................................
  4288.        MATHS                ˇˇˇˇˇˇFUNCTION        ˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇMATHS
  4289.  
  4290.        The following maths functions can be used anywhere in Easy Base
  4291.        code or field derivations.
  4292.  
  4293.        Log()
  4294.        Log10()
  4295.        Sqrt()
  4296.        Sin()
  4297.        Cos()
  4298.        Tan()
  4299.        Atan()
  4300.        Deg-rad()     converts degrees to radians
  4301.        Rad-deg()     converts radians to degrees
  4302.        Exp()         Raises e (the base of natural logarithms) to the
  4303.                      power of the parameter
  4304.  
  4305.  
  4306.        Acceptable parameters:
  4307.  
  4308.        Numeric value
  4309.        Numeric expression
  4310.        Numeric field/variable
  4311.        Any function returning a numeric value
  4312.  
  4313.  
  4314.  
  4315.  
  4316.  
  4317.  
  4318.  
  4319.  
  4320.  
  4321.  
  4322.  
  4323.  
  4324.  
  4325.  
  4326.  
  4327.  
  4328.  
  4329.  
  4330.  
  4331.  
  4332.  
  4333.  
  4334.  
  4335.  
  4336.  
  4337.  
  4338.  
  4339.  
  4340.  
  4341.  
  4342.  
  4343.                                  - 73 -
  4344. ................................................................................
  4345.        MAXIMIZING SPEED     ˇˇˇˇˇˇˇMETHOD         ˇˇˇˇMAXIMIZING SPEED
  4346.  
  4347.        Because the procedures you create in Easy Base have to be
  4348.        interpreted each time they are run they will tend to be slower
  4349.        than similar routines created in a compiled system. This is the
  4350.        unavoidable cost of ease of use. You can increase speed vastly
  4351.        by having the best DOS environment and by the way in which you
  4352.        write procedure code.
  4353.  
  4354.        DOS Environment.
  4355.  
  4356.        1.   Do not use a disk compression system.
  4357.  
  4358.        2.   Always load "Fastopen"  - The default settings are fine -
  4359.             just add the line "fastopen C:" to your AUTOEXEC.BAT file.
  4360.  
  4361.        3.   Use a Disk Cacheing system - The more memory you can
  4362.             allocate to it the better. Easy Software recommends
  4363.             PC-Cache from Centre Point with 2 Megabytes of expanded
  4364.             memory allocated. Smartdrive (Version supplied with
  4365.             Windows 3.1) was slightly faster but caused widespread
  4366.             disk corruptions during test "Power Failures".
  4367.        4.   Do not run any TSR programs (Especially Virus Checkers).
  4368.  
  4369.        Procedure Code.
  4370.  
  4371.        Avoid making calculations and derivations within "For" loops in
  4372.        procedures.
  4373.  
  4374.        If, for example, you had a form in which was recorded the
  4375.        length, breadth and depth of various blocks and you knew that
  4376.        at some point you would write a procedure which listed their
  4377.        volume. Add a field for volume to the form and derive it from
  4378.        the other fields. When you write the procedure you will simply
  4379.        list this field. If the field had not been added to the form
  4380.        then you would have to calculate its value on each iteration of
  4381.        the "For" loop.
  4382.  
  4383.        The time taken to derive each individual "Volume" field during
  4384.        record entry will not be noticeable but the time taken to
  4385.        derive the volume for every record during the procedure will.
  4386.  
  4387.        Keep "Running statistics".  If your program requires statistics
  4388.        derived from many hundreds or even thousands of records then
  4389.        having to wait for a procedure which calculates them each time
  4390.        you want up to date figures is a real pain.
  4391.  
  4392.        To keep "running statistics" create a form with a field for
  4393.        each statistic you require and enter a single record with zero
  4394.        values in each field. Make all entries, modifications and
  4395.        deletions to your data via procedures and you can update your
  4396.        statistics each time a record is added, modified or deleted.
  4397.  
  4398.        Example on next page.
  4399.  
  4400.                                  - 74 -
  4401. ................................................................................
  4402.        MAXIMIZING SPEED     ˇˇˇˇˇˇˇMETHOD         ˇˇˇˇMAXIMIZING SPEED
  4403.  
  4404.        The following procedure code enters a record (collected via the
  4405.        input screen) to a purchases ledger and updates statistics used
  4406.        in the profit and loss account. It also updates the balance for
  4407.        the suppliers account.
  4408.  
  4409.        pause off : Escape off
  4410.        for purchases new record
  4411.           copy all from input
  4412.        next
  4413.        for stats
  4414.           if input.type = "Invoice" then
  4415.              stats.creditors = stats.creditors + input.amount
  4416.           end if
  4417.           if input.type = "CreditNote" then
  4418.              stats.creditors = stats.creditors - input.amount
  4419.           end if
  4420.           if input.type = "Payment" then
  4421.              stats.creditors = stats.creditors - input.amount
  4422.              if input.paidby = "cash" then
  4423.                 stats.cashbalance = stats.cashbalance - input.amount
  4424.              else
  4425.                 stats.bankbalance = stats.bankbalance - input.amount
  4426.              end if
  4427.           end if
  4428.        next
  4429.        for ACbalances with supplier = input supplier
  4430.           if input.type = "Invoice" then
  4431.              ACbalances.balance = ACbalances.balance + input.amount
  4432.           else
  4433.              ACbalances.balance = ACbalances.balance - input.amount
  4434.           end if
  4435.        next
  4436.  
  4437.        Whenever you need to know statistics for "Debtors", "Cash
  4438.        Balance" etc you can produce them instantly with a procedure
  4439.        which simply lists data from the statistics forms.
  4440.  
  4441.        Whenever you use running statistics in this way you should also
  4442.        create a procedure which does calculate them from the raw data.
  4443.        If you ever, for one reason or another, have to edit data
  4444.        directly in "Data entry" then your "running statistics" will no
  4445.        longer be accurate. You can run this procedure to correct them.
  4446.  
  4447.  
  4448.  
  4449.  
  4450.  
  4451.  
  4452.  
  4453.  
  4454.  
  4455.  
  4456.  
  4457.                                  - 75 -
  4458. ................................................................................
  4459.        MENU CALLS           ˇˇˇˇMENU FUNCTION     ˇˇˇˇˇˇˇˇˇˇMENU CALLS
  4460.  
  4461.        In addition to the utilities which can be called from user
  4462.        menus the following calls can also be made.
  4463.  
  4464.        Run Procedure :   Runs a pre-defined procedure
  4465.  
  4466.        Last Output   :   Recalls the output from a procedure
  4467.  
  4468.        Data Entry    :   Allows direct access to a form
  4469.  
  4470.        User Menu     :   Calls another user menu
  4471.  
  4472.        System Menus  :   Calls the Easy Base System menus
  4473.  
  4474.        Run external program :  Shells to another program - You cannot
  4475.        run another major program from within Easy Base - there is very
  4476.        little spare memory - this call is however useful for calling
  4477.        batch files which export data to other programs for later use.
  4478.  
  4479.  
  4480.  
  4481.  
  4482.  
  4483.  
  4484.  
  4485.  
  4486.  
  4487.  
  4488.  
  4489.  
  4490.  
  4491.  
  4492.  
  4493.  
  4494.  
  4495.  
  4496.  
  4497.  
  4498.  
  4499.  
  4500.  
  4501.  
  4502.  
  4503.  
  4504.  
  4505.  
  4506.  
  4507.  
  4508.  
  4509.  
  4510.  
  4511.  
  4512.  
  4513.  
  4514.                                  - 76 -
  4515. ................................................................................
  4516.        MIDTEXT              ˇˇˇˇˇˇFUNCTION        ˇˇˇˇˇˇˇˇˇˇˇˇˇMIDTEXT
  4517.  
  4518.        This function returns a given number of characters from a given
  4519.        starting point in a field or variable.
  4520.  
  4521.        Ex.   Midtext(fileref,4,4)
  4522.              < Returns "Bill" from "TR/Bill/1243"
  4523.  
  4524.  
  4525.        Acceptable parameters:
  4526.  
  4527.        Text field/variable
  4528.        Any function returning a text value
  4529.  
  4530.  
  4531.  
  4532.  
  4533.  
  4534.  
  4535.  
  4536.  
  4537.  
  4538.  
  4539.  
  4540.  
  4541.  
  4542.  
  4543.  
  4544.  
  4545.  
  4546.  
  4547.  
  4548.  
  4549.  
  4550.  
  4551.  
  4552.  
  4553.  
  4554.  
  4555.  
  4556.  
  4557.  
  4558.  
  4559.  
  4560.  
  4561.  
  4562.  
  4563.  
  4564.  
  4565.  
  4566.  
  4567.  
  4568.  
  4569.  
  4570.  
  4571.                                  - 77 -
  4572. ................................................................................
  4573.        MINUTES              ˇˇˇˇˇˇFUNCTION        ˇˇˇˇˇˇˇˇˇˇˇˇˇMINUTES
  4574.  
  4575.        This function returns the minutes number from the time field
  4576.        parameter.
  4577.  
  4578.        Ex.    minutes(system time)
  4579.  
  4580.        Ex.
  4581.  
  4582.        Unitsperhour = rounddown(60/(minutes(endtime)-
  4583.        minutes(starttime)))
  4584.  
  4585.        Acceptable parameters:
  4586.  
  4587.        System time
  4588.        Time field
  4589.        Maketime function
  4590.        Time expression
  4591.  
  4592.  
  4593.  
  4594.  
  4595.  
  4596.  
  4597.  
  4598.  
  4599.  
  4600.  
  4601.  
  4602.  
  4603.  
  4604.  
  4605.  
  4606.  
  4607.  
  4608.  
  4609.  
  4610.  
  4611.  
  4612.  
  4613.  
  4614.  
  4615.  
  4616.  
  4617.  
  4618.  
  4619.  
  4620.  
  4621.  
  4622.  
  4623.  
  4624.  
  4625.  
  4626.  
  4627.  
  4628.                                  - 78 -
  4629. ................................................................................
  4630.        MOD                  ˇˇˇˇˇˇFUNCTION        ˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇMOD
  4631.  
  4632.        The Mod function returns the remainder of an integer division
  4633.  
  4634.        Ex. surplus rounds = mod(bullets,soldiers * ammoissue)
  4635.  
  4636.  
  4637.        Ex.
  4638.  
  4639.        for Historydates
  4640.           historydates.leapyear = "No"
  4641.           if mod(historydates.year,4) = 0 then
  4642.              historydates.leapyear = "Yes"
  4643.              update record
  4644.           end if
  4645.        next
  4646.        < This example fills a new field "leapyear" which has been
  4647.        added to the "Historydates" form after data has been entered>
  4648.  
  4649.        Acceptable parameters:
  4650.  
  4651.        Numeric value
  4652.        Numeric expression
  4653.        Numeric field/variable
  4654.        Any other function which returns a numeric value
  4655.  
  4656.  
  4657.  
  4658.  
  4659.  
  4660.  
  4661.  
  4662.  
  4663.  
  4664.  
  4665.  
  4666.  
  4667.  
  4668.  
  4669.  
  4670.  
  4671.  
  4672.  
  4673.  
  4674.  
  4675.  
  4676.  
  4677.  
  4678.  
  4679.  
  4680.  
  4681.  
  4682.  
  4683.  
  4684.  
  4685.                                  - 79 -
  4686. ................................................................................
  4687.        MONTH                ˇˇˇˇˇˇFUNCTION        ˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇMONTH
  4688.  
  4689.        This function returns the month number from a date parameter.
  4690.  
  4691.        Ex.    Month(system date)
  4692.  
  4693.        Ex.    Month(birthdate)
  4694.  
  4695.  
  4696.        Acceptable parameters
  4697.  
  4698.        System date
  4699.        Date field
  4700.        Makedate function
  4701.        Date expression
  4702.  
  4703.  
  4704.  
  4705.  
  4706.  
  4707.  
  4708.  
  4709.  
  4710.  
  4711.  
  4712.  
  4713.  
  4714.  
  4715.  
  4716.  
  4717.  
  4718.  
  4719.  
  4720.  
  4721.  
  4722.  
  4723.  
  4724.  
  4725.  
  4726.  
  4727.  
  4728.  
  4729.  
  4730.  
  4731.  
  4732.  
  4733.  
  4734.  
  4735.  
  4736.  
  4737.  
  4738.  
  4739.  
  4740.  
  4741.  
  4742.                                  - 80 -
  4743. ................................................................................
  4744.        MULTIPLE COLUMNS     ˇˇˇˇˇˇˇMETHOD         ˇˇˇˇMULTIPLE COLUMNS
  4745.  
  4746.        You may occasionally need to list data in order but in more
  4747.        than one column. Indexes for technical manuals are a common
  4748.        example. It would be nice if you could send the printer head
  4749.        back to the top of the page for each column but you can't. You
  4750.        must therefore get all the data for each horizontal line into
  4751.        memory at the same time and then print it.
  4752.  
  4753.        The following example prints the "Title" field from a "Films"
  4754.        form in alphabetic order in two columns with fifty lines on
  4755.        each page. To do this a field "No" is added to the form. This
  4756.        is an integer field and it is indexed.
  4757.  
  4758.        declare output fields
  4759.           films.title : righttitle
  4760.        end
  4761.        declare variables
  4762.           x as number  : y as number : lasttitle as text
  4763.        end
  4764.        '................UPDATE THE No FIELD......
  4765.        for films with title in order
  4766.           y = total records
  4767.           x = x + 1
  4768.           display status "Updating No field record" + x + "of" + y
  4769.           films.No = x
  4770.           update record
  4771.        next
  4772.        '.................PRINT IN TWO COLUMNS.................
  4773.        x = 0                        'reuse x as counter
  4774.        do
  4775.           for films with title > lasttitle
  4776.              x = x + 1
  4777.              for films alias col2 with No = films.No + 50
  4778.                righttitle = col2.title
  4779.              next
  4780.              print list items
  4781.              lasttitle = righttitle : righttitle = blank
  4782.              if mod(x,50) = 0 then
  4783.                 page feed : Exit for
  4784.              end if
  4785.           next
  4786.           if lasttitle = blank then exit do
  4787.        loop
  4788.  
  4789.        ........................Format..................
  4790.  
  4791.        .list items
  4792.              { Films.title field  }      {  Righttitle Field  }
  4793.        .end
  4794.  
  4795.  
  4796.  
  4797.  
  4798.  
  4799.                                  - 81 -
  4800. ................................................................................
  4801.        MULTIPLE LINES       ˇˇPROCEDURE COMMAND   ˇˇˇˇˇˇMULTIPLE LINES
  4802.  
  4803.        You can place multiple code instructions on a single line of
  4804.        the code editor by separating them with a colon.
  4805.  
  4806.        Ex.
  4807.  
  4808.        for ledger with lineno = input.lineno
  4809.           ledger.net = input.net:ledger.vat = input.vat
  4810.           ledger.acno = input.acno:ledger.gross = input.gross
  4811.           update record
  4812.        next
  4813.  
  4814.  
  4815.  
  4816.  
  4817.  
  4818.  
  4819.  
  4820.  
  4821.  
  4822.  
  4823.  
  4824.  
  4825.  
  4826.  
  4827.  
  4828.  
  4829.  
  4830.  
  4831.  
  4832.  
  4833.  
  4834.  
  4835.  
  4836.  
  4837.  
  4838.  
  4839.  
  4840.  
  4841.  
  4842.  
  4843.  
  4844.  
  4845.  
  4846.  
  4847.  
  4848.  
  4849.  
  4850.  
  4851.  
  4852.  
  4853.  
  4854.  
  4855.  
  4856.                                  - 82 -
  4857. ................................................................................
  4858.        ODD/EVEN PAGE PRINT  ˇˇPROCEDURE COMMAND   ˇODD/EVEN PAGE PRINT
  4859.  
  4860.        If you want to print procedure output on both sides of the
  4861.        paper then, unless you have a VERY expensive printer, the only
  4862.        way to achieve this is to print the odd pages, turn your paper
  4863.        over and print the even pages.  For a short report you can do
  4864.        this by setting paper feed to "Manual" from the utilities menu
  4865.        and turning each sheet over individually. If, however, you have
  4866.        a cut sheet feeder or a cartridge fed printer it is much
  4867.        quicker to print all the odd pages, turn them all over and then
  4868.        print all the even pages.
  4869.  
  4870.        To do this in Easy Base, issue the command "Odd Page Print"
  4871.        immediately before the print output and "Even Page Print"
  4872.        immediately after it.
  4873.  
  4874.        declare output fields
  4875.           customers.name : customers.phone
  4876.        end
  4877.        odd page print
  4878.        for customers with surname in order
  4879.           if bottom margin < .75 then page feed
  4880.           print list items
  4881.        next
  4882.        even page print    '(Easy Base pauses here till you are ready)
  4883.  
  4884.        If you will be binding your printed report down the left hand
  4885.        edge then you will need a larger left margin on the odd pages
  4886.        than on the even. If you start odd page printing with the
  4887.        command "Odd Page Print for Binding" then Easy Base will add
  4888.        half an inch to the format left margin when it prints the odd
  4889.        pages. You cannot alter the fixed value of half an inch but if
  4890.        you create your output format with a left margin of half an
  4891.        inch(suitable for the even pages) and print for binding, you
  4892.        will find that the resulting output suits most office binding
  4893.        systems.
  4894.  
  4895.        If you use Odd/Even page printing then it is important that you
  4896.        realize it is achieved by running the portion of your procedure
  4897.        between the "Odd Page Print" and "Even Page Print" twice -
  4898.        simply cancelling output to the printer at the appropriate
  4899.        times.  You must not, therefore include any commands which add,
  4900.        update or delete records between the commands. If you do they
  4901.        will be performed twice. Similarly if you are running a loop
  4902.        counter during the print process then it will have double the
  4903.        expected value after the "Even Page Print" command.
  4904.  
  4905.        The system value "Page Number" is reset to one at the "Even
  4906.        Page Print" command. If you include two separate sets of odd
  4907.        and even printing in a single procedure then you cannot use
  4908.        "Page Number" to number the second printout. You can of course
  4909.        use an ad hoc field. Just remember to reset it to one
  4910.        immediately before the "Even Page Print" command.
  4911.  
  4912.  
  4913.                                  - 83 -
  4914. ................................................................................
  4915.        ODD/EVEN PAGE PRINT  ˇˇPROCEDURE COMMAND   ˇODD/EVEN PAGE PRINT
  4916.  
  4917.        This document was written in an Easy Base form "Ref" which has
  4918.        fields "Name", "Type", "Pageno" "Topicpage" and three text
  4919.        block fields "T1", "T2" and "T3". Each record holds one page of
  4920.        the reference manual and the pages were entered in no
  4921.        particular order. The following procedure was used to number,
  4922.        sort, index and print the manual.
  4923.  
  4924.        declare output fields
  4925.           ref.name : ref.type :ref.pageno
  4926.           ref.t1 : ref.t2 : ref.t3 : type : name
  4927.        end
  4928.        declare variables
  4929.           x as number : y as number
  4930.           namelen as number : typelen as number
  4931.        end
  4932.        '.....................NUMBER REFERENCE PAGES....
  4933.        for ref with name in order
  4934.           y = total records
  4935.           x = x + 1
  4936.           display status "Numbering page" + x + "of" + y
  4937.           ref.pageno = x : update record
  4938.        next
  4939.        odd page print for binding
  4940.        '...............PRINT COMMANDS INDEX........
  4941.        bold on : print commandheader : bold off
  4942.        for ref with type = "procedure command"
  4943.           subindex name
  4944.        next
  4945.        for ref with subindex in order
  4946.           if topicpage > 1 then skiprec  'only first page
  4947.           ref.name = proper(ref.name)    'of each topic listed
  4948.           print commands
  4949.        next
  4950.        '..............PRINT SYSTEM VALUES INDEX...
  4951.        bold on : print valuesheader : bold off
  4952.        for ref with type = "system value"
  4953.           subindex name
  4954.        next
  4955.        for ref with subindex in order
  4956.           if topicpage > 1  then skiprec
  4957.           ref.name = proper(ref.name)
  4958.           print values
  4959.        next
  4960.        page feed       '... eject first index page
  4961.  
  4962.        '......... subsequent index pages are produced with exactly
  4963.        '........ the sane code as above and are omitted for clarity.
  4964.  
  4965.        '......................MAIN REFERENCE.............
  4966.        page feed
  4967.        for ref with name in order
  4968.           namelen = lengthtext(ref.name)
  4969.  
  4970.                                  - 84 -
  4971. ................................................................................
  4972.        ODD/EVEN PAGE PRINT  ˇˇPROCEDURE COMMAND   ˇODD/EVEN PAGE PRINT
  4973.  
  4974.           typelen = lengthtext(ref.type)
  4975.           '....centre justify type
  4976.           type = jointext(stringof((20-typelen)/2,chr$(255)),ref.type)
  4977.           '....right justify name
  4978.           name = jointext(stringof(20-namelen,chr$(255)),ref.name)
  4979.           bold on : print refheader : bold off  'type and names fields
  4980.           print list items                      't1, t2, t3
  4981.           bold on print reffoot                 'pageno
  4982.           page feed
  4983.        next
  4984.        even page print
  4985.  
  4986.  
  4987.  
  4988.  
  4989.  
  4990.  
  4991.  
  4992.  
  4993.  
  4994.  
  4995.  
  4996.  
  4997.  
  4998.  
  4999.  
  5000.  
  5001.  
  5002.  
  5003.  
  5004.  
  5005.  
  5006.  
  5007.  
  5008.  
  5009.  
  5010.  
  5011.  
  5012.  
  5013.  
  5014.  
  5015.  
  5016.  
  5017.  
  5018.  
  5019.  
  5020.  
  5021.  
  5022.  
  5023.  
  5024.  
  5025.  
  5026.  
  5027.                                  - 85 -
  5028. ................................................................................
  5029.        OPERATORS            ˇˇˇˇˇARITHMETIC       ˇˇˇˇˇˇˇˇˇˇˇOPERATORS
  5030.  
  5031.        The arithmetic operators used in Easy Base are:-
  5032.  
  5033.        +   (addition)
  5034.  
  5035.        -   (subtraction and negation)
  5036.  
  5037.        *   (multiplication)
  5038.  
  5039.        /   (division)
  5040.  
  5041.        ^   (exponentiation)
  5042.  
  5043.        Where there are multiple operators in a derivation they are
  5044.        processed with the following precedence:-
  5045.  
  5046.        1.   Exponentiation
  5047.        2.   Negation
  5048.        3.   Multiplication and Division
  5049.        4.   Addition and Subtraction
  5050.  
  5051.        The default precedence can be altered by the use of
  5052.        parenthesis.
  5053.  
  5054.             Easy base does not perform Integer Arithmetic.
  5055.  
  5056.        When a numeric field shows the result of a division the
  5057.        "displayed" number is "truncated" to an integer in Integer
  5058.        fields and has the last digit rounded in Fixed Point and
  5059.        Floating Point fields.  The "Stored" value which is used in any
  5060.        further calculations, however, is always correct to 15
  5061.        significant figures irrelevant of field type.  For Example: If
  5062.        three fields x,y and z are defined as integers, y is derived as
  5063.        x/4 and z is derived as y*4 then when 9 is entered in x, y will
  5064.        derive as 2 but z will derive as 9 because it multiplies the
  5065.        "stored value" of 2.25 by 4 not the displayed value of 2.
  5066.  
  5067.        Handling arithmetic in this way means that, by default there
  5068.        are no rounding errors. This has several advantages not least
  5069.        that currency values need only ever be defined to two decimal
  5070.        places.
  5071.  
  5072.        It does mean, however, that should you require rounding errors
  5073.        to be carried forward you must use one of the Easy Base
  5074.        rounding functions on the result of any intermediate division.
  5075.  
  5076.        In the above example, had y been derived as "round(x/4)" then z
  5077.        would derive as 8.
  5078.  
  5079.        If a fourth field had the formula:- if(y = 2,5,10) it would
  5080.        only derive as 5 if y had been rounded or if 8 had been entered
  5081.        in x.
  5082.  
  5083.  
  5084.                                  - 86 -
  5085. ................................................................................
  5086.        OPERATORS            ˇˇˇˇˇRELATIONAL       ˇˇˇˇˇˇˇˇˇˇˇOPERATORS
  5087.  
  5088.        Easy base uses the following relational operators:-
  5089.  
  5090.        =    (equals)
  5091.        <>   (not equals)
  5092.        >    (greater than)
  5093.        <    (less than)
  5094.        >=   (greater than or equal to)
  5095.        <=   (less than or equal to)
  5096.  
  5097.  
  5098.        Where relational operators and arithmetic operators are both
  5099.        used in a derivation. Relational operations are performed after
  5100.        arithmetic operations.
  5101.  
  5102.        Text values are not case sensitive when compared with
  5103.        relational operators.
  5104.  
  5105.        When you compare two fields or variables, the comparison is
  5106.        numeric if both are numeric and alphabetic if both are
  5107.        alphabetic.  If you compare a numeric field with a text field
  5108.        then Easy Base will test to see if the text field contains a
  5109.        number.  If it does then the comparison will be numeric and if
  5110.        it does not then the comparison will be alphabetic.
  5111.  
  5112.        WARNING
  5113.  
  5114.        If you compare the result of a division in an integer or fixed
  5115.        point field using the = or the <> operators, then the value
  5116.        used for comparison will be the (accurate) stored value and not
  5117.        the "Truncated" number shown in the field.
  5118.  
  5119.        See Operators Arithmetic
  5120.  
  5121.  
  5122.  
  5123.  
  5124.  
  5125.  
  5126.  
  5127.  
  5128.  
  5129.  
  5130.  
  5131.  
  5132.  
  5133.  
  5134.  
  5135.  
  5136.  
  5137.  
  5138.  
  5139.  
  5140.  
  5141.                                  - 87 -
  5142. ................................................................................
  5143.        OPERATORS            ˇˇˇˇˇˇLOGICAL         ˇˇˇˇˇˇˇˇˇˇˇOPERATORS
  5144.  
  5145.        Easy Base uses the following logical operators:-
  5146.  
  5147.        1.  and
  5148.        2.  or
  5149.        3.  xor     (or exclusive)
  5150.        4.  eqv     (equivalence)
  5151.        5.  imp     (implication)
  5152.  
  5153.        Logical operations are performed last after arithmetic and
  5154.        relational.
  5155.  
  5156.        Logical operators return a boolean (true or false) value from
  5157.        two other boolean expressions.
  5158.  
  5159.        Ex.
  5160.  
  5161.        If(x = y and a = b,"Yes","No")
  5162.           < Yes is returned if both expressions are true >
  5163.  
  5164.        If(x = y or a = b,"Yes","No")
  5165.           < Yes is returned if either or both expressions are true >
  5166.  
  5167.        If(x = y xor a = b,"Yes","No")
  5168.           < Yes is returned if either one but not both are true >
  5169.  
  5170.        If(x = y eqv a = b,"Yes","No")
  5171.           < Yes is returned if both expressions are true or if both
  5172.             expressions are false >
  5173.  
  5174.        If(x = y imp a = b,"Yes","No")
  5175.  
  5176.           < Yes is returned for all combinations except the first
  5177.             expression being true and the second false >
  5178.  
  5179.        The Easy Base logical operators are primarily designed for use
  5180.        within the "If" function and in "If..Then..Else" constructions
  5181.        where their actual value is not relevant. If you wish to use
  5182.        the value of "false" in formulae then it is represented by 0.
  5183.        True can be represented by any value other than 0 and should
  5184.        not be used.
  5185.  
  5186.  
  5187.  
  5188.  
  5189.  
  5190.  
  5191.  
  5192.  
  5193.  
  5194.  
  5195.  
  5196.  
  5197.  
  5198.                                  - 88 -
  5199. ................................................................................
  5200.        OPTIONS              ˇˇˇˇˇˇUTILITY         ˇˇˇˇˇˇˇˇˇˇˇˇˇOPTIONS
  5201.  
  5202.        The "Options" utility allows you to select your preferred date
  5203.        format (European or North American). You can also enable or
  5204.        disable screen saving. If enabled the screen saver operates
  5205.        after three minutes without a keypress during record entry,
  5206.        procedure screen entry or if a menu is being displayed. The
  5207.        screensaver is never invoked while a procedure is running or
  5208.        while reformatting or re-indexing is taking place.
  5209.  
  5210.        The options utility can be called as a user menu function so
  5211.        that an end user can access the facilities without access to
  5212.        the system menus.
  5213.  
  5214.  
  5215.  
  5216.  
  5217.  
  5218.  
  5219.  
  5220.  
  5221.  
  5222.  
  5223.  
  5224.  
  5225.  
  5226.  
  5227.  
  5228.  
  5229.  
  5230.  
  5231.  
  5232.  
  5233.  
  5234.  
  5235.  
  5236.  
  5237.  
  5238.  
  5239.  
  5240.  
  5241.  
  5242.  
  5243.  
  5244.  
  5245.  
  5246.  
  5247.  
  5248.  
  5249.  
  5250.  
  5251.  
  5252.  
  5253.  
  5254.  
  5255.                                  - 89 -
  5256. ................................................................................
  5257.        OUTPUT               ˇˇˇˇSYSTEM VALUE      ˇˇˇˇˇˇˇˇˇˇˇˇˇˇOUTPUT
  5258.  
  5259.        When a user runs a procedure his choice of output, screen,
  5260.        printer or disk is stored in the system value "Output".
  5261.  
  5262.        By accessing the system value "Output" you can make your
  5263.        procedure do different things depending on where the output is
  5264.        to be sent.
  5265.  
  5266.        Ex.
  5267.  
  5268.        if output = "screen" then
  5269.           print heading1
  5270.        else
  5271.           print heading2
  5272.        end if
  5273.  
  5274.  
  5275.  
  5276.  
  5277.  
  5278.  
  5279.  
  5280.  
  5281.  
  5282.  
  5283.  
  5284.  
  5285.  
  5286.  
  5287.  
  5288.  
  5289.  
  5290.  
  5291.  
  5292.  
  5293.  
  5294.  
  5295.  
  5296.  
  5297.  
  5298.  
  5299.  
  5300.  
  5301.  
  5302.  
  5303.  
  5304.  
  5305.  
  5306.  
  5307.  
  5308.  
  5309.  
  5310.  
  5311.  
  5312.                                  - 90 -
  5313. ................................................................................
  5314.        PACK DATA FORMS      ˇˇˇˇˇˇUTILITY         ˇˇˇˇˇPACK DATA FORMS
  5315.  
  5316.        The process of actually removing a deleted record from a form
  5317.        is time consuming. What actually happens is that all the "Live"
  5318.        records are copied to a temporary file. The original file is
  5319.        then deleted and the temporary one re-named to the original
  5320.        name. Because of this it is actually quicker to remove fifty
  5321.        "Dead" records than it is to remove one. To save you time Easy
  5322.        base follows the traditional data-base custom of simply marking
  5323.        records for deletion when you delete them. They are only
  5324.        physically removed from the form during a "Pack" operation.
  5325.        When you "Pack" a data file Easy Base also re-writes all the
  5326.        index files for that form. You can pack individual forms with
  5327.        the "Pack Data Forms" utility accessed from the Utilities menu.
  5328.        You can also call the "Pack Data Forms" utility as a User menu
  5329.        function. In a finished application any necessary packing would
  5330.        normally be done from a batch execute menu which would run
  5331.        while the computer was unattended.
  5332.  
  5333.        Forms in which records are regularly deleted should be packed
  5334.        regularly. If packing is not done then not only will you be
  5335.        wasting disk space but search operations will become
  5336.        progressively slower as the percentage of "Dead" records
  5337.        increases.
  5338.  
  5339.        This is fairly obvious - however it is not so obvious that a
  5340.        forms index files can accumulate "Dead" records even though
  5341.        none have been deleted from the main file. An index file is
  5342.        simply the indexed fields contents and record number arranged
  5343.        in order. If, having filed a record you then alter the contents
  5344.        of an indexed field and update the record then the original
  5345.        record in the index file is deleted and a new one entered.
  5346.  
  5347.        Index files with "Dead records" also waste disk space and slow
  5348.        search operations. You should therefore regularly pack any
  5349.        forms which are regularly updated.
  5350.  
  5351.        If you are unsure which forms need to be packed you can use the
  5352.        "Auto-Pack" utility which tests each form and each forms index
  5353.        files for "Dead" records. The form is packed if it or any of
  5354.        its index files is found to have more then 100 total or 10 per
  5355.        cent "Dead" records.
  5356.  
  5357.        Although "Auto-Pack" may seem the easy answer, an application
  5358.        will almost certainly have several forms with "Core" data which
  5359.        remain unchanged and therefore never require packing. If you
  5360.        can identify the forms which do need to be packed and do them
  5361.        individually or from a batch execute menu this will be less
  5362.        time consuming than always using the "Auto-Pack" facility.
  5363.  
  5364.  
  5365.  
  5366.  
  5367.  
  5368.  
  5369.                                  - 91 -
  5370. ................................................................................
  5371.        PAGE NUMBER          ˇˇˇˇSYSTEM VALUE      ˇˇˇˇˇˇˇˇˇPAGE NUMBER
  5372.  
  5373.        Whenever Easy Base is processing a procedure with an output it
  5374.        keeps track of the current page number (Even if you have not
  5375.        included Page Feed commands). You can use the system value
  5376.        "Page Number" to number the pages of your output. To use the
  5377.        "Page Number" value just include "Page Number" in your output
  5378.        field declarations.
  5379.  
  5380.        Declare output fields
  5381.           Customers.name : Customers.ACNO : Page Number
  5382.        end
  5383.  
  5384.        You can then use the "Page Number" field in the Page Header or
  5385.        Page Footer section of your output format.
  5386.  
  5387.  
  5388.  
  5389.  
  5390.  
  5391.  
  5392.  
  5393.  
  5394.  
  5395.  
  5396.  
  5397.  
  5398.  
  5399.  
  5400.  
  5401.  
  5402.  
  5403.  
  5404.  
  5405.  
  5406.  
  5407.  
  5408.  
  5409.  
  5410.  
  5411.  
  5412.  
  5413.  
  5414.  
  5415.  
  5416.  
  5417.  
  5418.  
  5419.  
  5420.  
  5421.  
  5422.  
  5423.  
  5424.  
  5425.  
  5426.                                  - 92 -
  5427. ................................................................................
  5428.        PAUSE ON/OFF         ˇˇPROCEDURE COMMAND   ˇˇˇˇˇˇˇˇPAUSE ON/OFF
  5429.  
  5430.        When an Easy Base procedure has an output to the screen, the
  5431.        output, by default scrolls continuously until the procedure is
  5432.        complete. You can allow the user to pause the output with the
  5433.        "Pause On" command.
  5434.  
  5435.        If a procedure performs several tasks then the pause facility
  5436.        can be selectively enabled and disabled at any point.
  5437.  
  5438.        Ex.
  5439.  
  5440.        for employees alias types with type in order unique
  5441.           pause off:escape off
  5442.           for employees alias group with type = types.type
  5443.              subindex surname
  5444.           next
  5445.           pause on
  5446.           for employees with subindex in order
  5447.              print list items
  5448.           next
  5449.        next
  5450.  
  5451.        The above code fragment prints employees details in type groups
  5452.        with surname in alphabetic order. During the procedure the user
  5453.        can pause the report while it is listing the output but not
  5454.        while it is subindexing the group.
  5455.  
  5456.  
  5457.  
  5458.  
  5459.  
  5460.  
  5461.  
  5462.  
  5463.  
  5464.  
  5465.  
  5466.  
  5467.  
  5468.  
  5469.  
  5470.  
  5471.  
  5472.  
  5473.  
  5474.  
  5475.  
  5476.  
  5477.  
  5478.  
  5479.  
  5480.  
  5481.  
  5482.  
  5483.                                  - 93 -
  5484. ................................................................................
  5485.        PI                   ˇˇˇˇSYSTEM VALUE      ˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇPI
  5486.  
  5487.        You can use the value of „ anywhere in field derivations or
  5488.        procedure code by quoting "Pi".
  5489.  
  5490.        Ex     circlearea = Pi / 4 diam^2
  5491.  
  5492.  
  5493.  
  5494.  
  5495.  
  5496.  
  5497.  
  5498.  
  5499.  
  5500.  
  5501.  
  5502.  
  5503.  
  5504.  
  5505.  
  5506.  
  5507.  
  5508.  
  5509.  
  5510.  
  5511.  
  5512.  
  5513.  
  5514.  
  5515.  
  5516.  
  5517.  
  5518.  
  5519.  
  5520.  
  5521.  
  5522.  
  5523.  
  5524.  
  5525.  
  5526.  
  5527.  
  5528.  
  5529.  
  5530.  
  5531.  
  5532.  
  5533.  
  5534.  
  5535.  
  5536.  
  5537.  
  5538.  
  5539.  
  5540.                                  - 94 -
  5541. ................................................................................
  5542.        PRESELECT            ˇˇPROCEDURE COMMAND   ˇˇˇˇˇˇˇˇˇˇˇPRESELECT
  5543.  
  5544.        The "Preselect" command sets highlighting of the next user menu
  5545.        when the procedure terminates.  If a procedure is normally
  5546.        followed by a particular selection from the menu then you can
  5547.        save the user the trouble of choosing it by issuing the
  5548.        "Preselect" command within the procedure.
  5549.  
  5550.        for currentcustomer
  5551.           currentcustomer.acno = input.acno
  5552.           update record
  5553.        next
  5554.        preselect 4
  5555.  
  5556.  
  5557.  
  5558.  
  5559.  
  5560.  
  5561.  
  5562.  
  5563.  
  5564.  
  5565.  
  5566.  
  5567.  
  5568.  
  5569.  
  5570.  
  5571.  
  5572.  
  5573.  
  5574.  
  5575.  
  5576.  
  5577.  
  5578.  
  5579.  
  5580.  
  5581.  
  5582.  
  5583.  
  5584.  
  5585.  
  5586.  
  5587.  
  5588.  
  5589.  
  5590.  
  5591.  
  5592.  
  5593.  
  5594.  
  5595.  
  5596.  
  5597.                                  - 95 -
  5598. ................................................................................
  5599.        PRINT                ˇˇPROCEDURE COMMAND   ˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇPRINT
  5600.  
  5601.        In Easy Base procedures, all output to the screen or printer is
  5602.        initiated with the "Print" command. The "Print" command prints
  5603.        sections from the procedures output format.
  5604.  
  5605.        Ex.
  5606.  
  5607.        '......................procedure code....
  5608.        Print report header
  5609.        for customers
  5610.           print list items
  5611.        next
  5612.        print report footer
  5613.        '......................Output Format.......
  5614.        .Report Header
  5615.              ÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕ
  5616.                            Customer List
  5617.              ÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕ
  5618.        .List Items
  5619.              {customers.name field}  {customers.phone field}
  5620.        .Report Footer
  5621.              ÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕ
  5622.        .end
  5623.  
  5624.        The format sections are marked with a full stop in the margin
  5625.        followed by the section name. When you type a full stop in the
  5626.        margin of the "Format editor" Easy Base will offer you a
  5627.        selection of section names. You do not have to use these - they
  5628.        are just some common names that can save you time. To enter
  5629.        your own section names just press escape and type in any name
  5630.        you wish.
  5631.  
  5632.        The ".end" section is not strictly necessary but it is easy to
  5633.        accidentally insert blank lines at the end of your format. By
  5634.        inserting ".end" at the end of the last section you will
  5635.        prevent these from being printed.
  5636.  
  5637.  
  5638.  
  5639.  
  5640.  
  5641.  
  5642.  
  5643.  
  5644.  
  5645.  
  5646.  
  5647.  
  5648.  
  5649.  
  5650.  
  5651.  
  5652.  
  5653.  
  5654.                                  - 96 -
  5655. ................................................................................
  5656.        PRINTER CONTROL      ˇˇPROCEDURE COMMAND   ˇˇˇˇˇPRINTER CONTROL
  5657.  
  5658.        When you send a procedure output to the printer Easy Base will
  5659.        initialize your printer at ten characters per inch, six lines
  5660.        per inch in draft mode.
  5661.  
  5662.        You can alter the printer mode anywhere within a procedure with
  5663.        the following printer controls.
  5664.  
  5665.        Bold On            Bold Off
  5666.        Underline On       Underline Off
  5667.        Italic On          Italic Off
  5668.        NLQ On             NLQ Off
  5669.  
  5670.        8 lpi      Sets printing to eight lines per inch
  5671.        6 lpi      Sets printing to six lines per inch
  5672.        10 cpi     Sets printing to ten characters per inch
  5673.        12 cpi     Sets printing to twelve characters per inch
  5674.        17 cpi     sets printing to either 15 or 17 depending on
  5675.                   printer
  5676.        Line Feed  Advances the print head one line
  5677.        Page Feed  Ejects the current page.
  5678.  
  5679.        Ex.
  5680.        NLQ On
  5681.        Bold on
  5682.        Print report header
  5683.        Bold Off
  5684.        12 CPI
  5685.        For customers
  5686.           print list items
  5687.           if bottom margin < 1.5 then
  5688.              Line feed : Bold On : 10 CPI
  5689.              Print Page footer
  5690.              Page feed
  5691.              Print Page header
  5692.              Bold Off : 12 CPI
  5693.           end if
  5694.        next
  5695.        Bold on:Italic On :10 CPI
  5696.        print report footer
  5697.  
  5698.        The above example turns Near Letter Quality printing on for the
  5699.        entire report. It prints page headers and footers in bold at 10
  5700.        characters per inch, list items at 12 characters per inch and
  5701.        the report footer in bold italics.
  5702.  
  5703.  
  5704.  
  5705.  
  5706.  
  5707.  
  5708.  
  5709.  
  5710.  
  5711.                                  - 97 -
  5712. ................................................................................
  5713.        PROPER               ˇˇˇˇˇˇFUNCTION        ˇˇˇˇˇˇˇˇˇˇˇˇˇˇPROPER
  5714.  
  5715.        This function returns the parameter with the first letter of
  5716.        each word in upper case and the rest in lower case. If you wish
  5717.        to enter initials in a field derived as proper and keep them in
  5718.        upper case then there must either be a space or a full stop
  5719.        between them.
  5720.  
  5721.        Ex.     Proper(Address)
  5722.  
  5723.        Ex.
  5724.  
  5725.        labelname = upper(company.name)
  5726.        insetname = proper(company.name)
  5727.  
  5728.  
  5729.        Acceptable parameters:
  5730.  
  5731.        Quoted text
  5732.        Text field/variable
  5733.  
  5734.  
  5735.  
  5736.  
  5737.  
  5738.  
  5739.  
  5740.  
  5741.  
  5742.  
  5743.  
  5744.  
  5745.  
  5746.  
  5747.  
  5748.  
  5749.  
  5750.  
  5751.  
  5752.  
  5753.  
  5754.  
  5755.  
  5756.  
  5757.  
  5758.  
  5759.  
  5760.  
  5761.  
  5762.  
  5763.  
  5764.  
  5765.  
  5766.  
  5767.  
  5768.                                  - 98 -
  5769. ................................................................................
  5770.        Q AND A INPUT SCREEN ˇˇˇˇˇˇˇMETHOD         Q AND A INPUT SCREEN
  5771.  
  5772.        If, for a procedure you have to collect many items of data via
  5773.        an input screen, then presenting all the fields and their
  5774.        labels at once can be confusing to an operator.  You can start
  5775.        with an empty screen other than the first field and its prompt
  5776.        then have each subsequent prompt "Pop up" when the previous
  5777.        field has been filled.
  5778.  
  5779.        To do this you make all your input fields without a background
  5780.        (Text, Alt1 or Alt2) and you create fields for the prompts
  5781.        which have no user entry and also show no background.
  5782.  
  5783.        Ex.
  5784.  
  5785.        To collect data for paymethod, customer, and amount lay out the
  5786.        following fields:-
  5787.  
  5788.                Enter Method of payment....     { Paymethod Field }
  5789.                { Pop1 Field               }    { Customer Field  }
  5790.                { Pop2 Field               }    { Amount Field   }
  5791.  
  5792.        The "Pop1" field is derived:-
  5793.  
  5794.           If(Pop1 = blank and paymethod = blank,blank,"Enter Customers
  5795.                   name.........")
  5796.  
  5797.        and the "Pop2" field is derived:-
  5798.  
  5799.           If(Pop2 = blank and customer = blank,blank,"Enter Amount...
  5800.                  ...............")
  5801.  
  5802.  
  5803.  
  5804.  
  5805.  
  5806.  
  5807.  
  5808.  
  5809.  
  5810.  
  5811.  
  5812.  
  5813.  
  5814.  
  5815.  
  5816.  
  5817.  
  5818.  
  5819.  
  5820.  
  5821.  
  5822.  
  5823.  
  5824.  
  5825.                                  - 99 -
  5826. ................................................................................
  5827.        RANDOM               ˇˇˇˇˇˇFUNCTION        ˇˇˇˇˇˇˇˇˇˇˇˇˇˇRANDOM
  5828.  
  5829.        This function returns a random number between the upper and
  5830.        lower parameters.
  5831.  
  5832.        Ex.  Random(1,100)
  5833.           <Returns a random number between 1 and 100>
  5834.  
  5835.        Ex.  The two fields No and card simulate the random cutting of
  5836.        a deck of cards each time the No field is cleared.
  5837.  
  5838.        No field derivation:-
  5839.            if(no <> blank,no,random(1,52))
  5840.  
  5841.        Card field derivation:-
  5842.  
  5843.            jointext(if(mod(no,13) = 1,"Ace",mod(no,13) = 0,"King",
  5844.        mod(no,13) = 12,"Queen",mod(no,13) = 11,"Jack",mod(no,13)),
  5845.        " of ",if(no < 14,"Hearts",no < 27 ,"Clubs",no <40,"Diamonds",
  5846.        ,"Spades"))
  5847.  
  5848.  
  5849.        Acceptable parameters
  5850.  
  5851.        Numeric Value
  5852.        Numeric expression
  5853.        Numeric field/variable
  5854.        Any other function which returns a numeric value
  5855.  
  5856.  
  5857.  
  5858.  
  5859.  
  5860.  
  5861.  
  5862.  
  5863.  
  5864.  
  5865.  
  5866.  
  5867.  
  5868.  
  5869.  
  5870.  
  5871.  
  5872.  
  5873.  
  5874.  
  5875.  
  5876.  
  5877.  
  5878.  
  5879.  
  5880.  
  5881.  
  5882.                                  - 100 -
  5883. ................................................................................
  5884.        REBUILD DIRECTORIES  ˇˇˇˇˇˇUTILITY         ˇREBUILD DIRECTORIES
  5885.  
  5886.        In Easy Base, all DOS file handling is taken care of for you in
  5887.        the background. To do this Easy Base maintains three
  5888.        "Directory" files in which the names which you give to forms,
  5889.        procedures and choice field lists are linked to the actual DOS
  5890.        filenames.
  5891.  
  5892.        The three files are :-
  5893.  
  5894.        BASE.DIR     The forms directory
  5895.        PROC.DIR     The procedures directory
  5896.        CHOICES.DIR  The choice list directory
  5897.  
  5898.        Because these are key files, Easy Base includes a utility which
  5899.        will rebuild them in the event of accidental erasure or
  5900.        corruption.
  5901.  
  5902.  
  5903.  
  5904.  
  5905.  
  5906.  
  5907.  
  5908.  
  5909.  
  5910.  
  5911.  
  5912.  
  5913.  
  5914.  
  5915.  
  5916.  
  5917.  
  5918.  
  5919.  
  5920.  
  5921.  
  5922.  
  5923.  
  5924.  
  5925.  
  5926.  
  5927.  
  5928.  
  5929.  
  5930.  
  5931.  
  5932.  
  5933.  
  5934.  
  5935.  
  5936.  
  5937.  
  5938.  
  5939.                                  - 101 -
  5940. ................................................................................
  5941.        RECORD NUMBER        ˇˇˇˇSYSTEM VALUE      ˇˇˇˇˇˇˇRECORD NUMBER
  5942.  
  5943.        If you derive a field with the formula "record number" it will
  5944.        be filled with the record number at the time of filing or
  5945.        reformatting.  Record number differs from "sequence" in the
  5946.        following way. Each time you derive a field with "sequence" you
  5947.        get the next sequencial number irrespective of whether the form
  5948.        has had records deleted and has been repacked. If a file has
  5949.        had at some time 500 records but now only has 20 the next
  5950.        derivation of "sequence" will be 501 and the next derivation of
  5951.        "record number" will be 21.
  5952.  
  5953.        The main use of "record number" is to renumber a set of records
  5954.        after deletions. To do this just add a new field to the form
  5955.        derived as record number. The field will be filled
  5956.        automatically during the data reformatting process.
  5957.  
  5958.        Record Number has no meaning in procedure code.
  5959.  
  5960.        See Also:-  Current Record Number
  5961.  
  5962.  
  5963.  
  5964.  
  5965.  
  5966.  
  5967.  
  5968.  
  5969.  
  5970.  
  5971.  
  5972.  
  5973.  
  5974.  
  5975.  
  5976.  
  5977.  
  5978.  
  5979.  
  5980.  
  5981.  
  5982.  
  5983.  
  5984.  
  5985.  
  5986.  
  5987.  
  5988.  
  5989.  
  5990.  
  5991.  
  5992.  
  5993.  
  5994.  
  5995.  
  5996.                                  - 102 -
  5997. ................................................................................
  5998.        REMARK               ˇˇPROCEDURE COMMAND   ˇˇˇˇˇˇˇˇˇˇˇˇˇˇREMARK
  5999.  
  6000.        You can place remarks anywhere within Easy base procedure code
  6001.        by prefixing them with an apostrophe.
  6002.  
  6003.        Ex.
  6004.  
  6005.        '.................This entire line is a remark.....
  6006.        for pupils with age > 9
  6007.           if grade = "g" then skip record   'exclude g's from count
  6008.           count = count + 1                 'These are remarks
  6009.        next
  6010.        '..............................................
  6011.  
  6012.        All text to the right of the apostrophe is ignored at run time.
  6013.  
  6014.  
  6015.  
  6016.  
  6017.  
  6018.  
  6019.  
  6020.  
  6021.  
  6022.  
  6023.  
  6024.  
  6025.  
  6026.  
  6027.  
  6028.  
  6029.  
  6030.  
  6031.  
  6032.  
  6033.  
  6034.  
  6035.  
  6036.  
  6037.  
  6038.  
  6039.  
  6040.  
  6041.  
  6042.  
  6043.  
  6044.  
  6045.  
  6046.  
  6047.  
  6048.  
  6049.  
  6050.  
  6051.  
  6052.  
  6053.                                  - 103 -
  6054. ................................................................................
  6055.        RESTORE              ˇˇˇˇˇˇUTILITY         ˇˇˇˇˇˇˇˇˇˇˇˇˇRESTORE
  6056.  
  6057.        Easy Base will restore applications or data which it has backed
  6058.        up. You can only restore an application with the "Restore
  6059.        Application" utility called from the utilities menu and you can
  6060.        only restore data-only backups with the "Restore Data" utility
  6061.        called from a user menu.
  6062.  
  6063.  
  6064.        See Also:-  Backup
  6065.  
  6066.  
  6067.  
  6068.  
  6069.  
  6070.  
  6071.  
  6072.  
  6073.  
  6074.  
  6075.  
  6076.  
  6077.  
  6078.  
  6079.  
  6080.  
  6081.  
  6082.  
  6083.  
  6084.  
  6085.  
  6086.  
  6087.  
  6088.  
  6089.  
  6090.  
  6091.  
  6092.  
  6093.  
  6094.  
  6095.  
  6096.  
  6097.  
  6098.  
  6099.  
  6100.  
  6101.  
  6102.  
  6103.  
  6104.  
  6105.  
  6106.  
  6107.  
  6108.  
  6109.  
  6110.                                  - 104 -
  6111. ................................................................................
  6112.        RETAIL               ˇˇˇˇˇˇFUNCTION        ˇˇˇˇˇˇˇˇˇˇˇˇˇˇRETAIL
  6113.  
  6114.        The retail function returns the retail price given the
  6115.        wholesale price and the discount as a percentage of retail.
  6116.  
  6117.        Ex   Retail(cost,discount)
  6118.  
  6119.             < returns 125 if cost = 100 and discount = 20>
  6120.  
  6121.  
  6122.  
  6123.  
  6124.  
  6125.  
  6126.  
  6127.  
  6128.  
  6129.  
  6130.  
  6131.  
  6132.  
  6133.  
  6134.  
  6135.  
  6136.  
  6137.  
  6138.  
  6139.  
  6140.  
  6141.  
  6142.  
  6143.  
  6144.  
  6145.  
  6146.  
  6147.  
  6148.  
  6149.  
  6150.  
  6151.  
  6152.  
  6153.  
  6154.  
  6155.  
  6156.  
  6157.  
  6158.  
  6159.  
  6160.  
  6161.  
  6162.  
  6163.  
  6164.  
  6165.  
  6166.  
  6167.                                  - 105 -
  6168. ................................................................................
  6169.        RETEST               ˇˇDERIVATION PREFIX   ˇˇˇˇˇˇˇˇˇˇˇˇˇˇRETEST
  6170.  
  6171.        In Easy Base, fields are derived when a new record is started
  6172.        and when any other field which affects the derivation is
  6173.        changed. You can force a field to be rederived when F2 is
  6174.        pressed by prefixing the derivation with "retest".
  6175.  
  6176.        Suppose you have a field "degrees" in which the user must enter
  6177.        a number between 1 and 360.
  6178.  
  6179.        To prevent him entering an out of range number you could derive
  6180.        the field :-
  6181.  
  6182.        If(degrees<1 or degrees > 360,blank[beepInvalid number of
  6183.        degreesCursor degrees],degrees)
  6184.  
  6185.        The above derivation would prevent the user from filing a
  6186.        record with an out of range number. However, by the time he
  6187.        read the message, his entry would be blanked out. It would be
  6188.        better if the number he had typed could be left in the field so
  6189.        that he could see his error. To do this all you have to do is
  6190.        change "blank" to "degrees" in the above derivation.
  6191.  
  6192.        This however would allow the user ( Should he decide to ignore
  6193.        the message ) to then file the incorrect value. To leave the
  6194.        value in the field and still prevent the user from filing it,
  6195.        use the "retest" prefix.
  6196.  
  6197.        Retest If(degrees<1 or degrees > 360,degrees[beepInvalid number
  6198.        of degreesCursor degrees],degrees)
  6199.  
  6200.  
  6201.        Note: You can only have one prefix on any one field derivation.
  6202.  
  6203.  
  6204.  
  6205.  
  6206.  
  6207.  
  6208.  
  6209.  
  6210.  
  6211.  
  6212.  
  6213.  
  6214.  
  6215.  
  6216.  
  6217.  
  6218.  
  6219.  
  6220.  
  6221.  
  6222.  
  6223.  
  6224.                                  - 106 -
  6225. ................................................................................
  6226.        REVERSE              ˇˇˇˇˇˇFUNCTION        ˇˇˇˇˇˇˇˇˇˇˇˇˇREVERSE
  6227.  
  6228.        The reverse function is used in the creation of compound index
  6229.        fields. What it actually does is alter the characters of the
  6230.        parameter in such a way that an alphabetic listing of a field
  6231.        after reversal will have the reverse order to that of the
  6232.        original characters before using the reverse function.
  6233.  
  6234.        In the example shown for the function "zeropad", had you wished
  6235.        to list the pupils in descending age order there would be no
  6236.        point in using the procedure code:
  6237.  
  6238.        for pupils with unifield in reverse order
  6239.  
  6240.        as this would not only reverse the age grouping but would also
  6241.        reverse the name order.
  6242.  
  6243.        To produce the desired printout use exactly the same procedure
  6244.        but derive "unifield" as:-
  6245.  
  6246.        Jointext(reverse(zeropad(age,2,0)),name)
  6247.  
  6248.  
  6249.  
  6250.  
  6251.  
  6252.  
  6253.  
  6254.  
  6255.  
  6256.  
  6257.  
  6258.  
  6259.  
  6260.  
  6261.  
  6262.  
  6263.  
  6264.  
  6265.  
  6266.  
  6267.  
  6268.  
  6269.  
  6270.  
  6271.  
  6272.  
  6273.  
  6274.  
  6275.  
  6276.  
  6277.  
  6278.  
  6279.  
  6280.  
  6281.                                  - 107 -
  6282. ................................................................................
  6283.        RIGHTTEXT            ˇˇˇˇˇˇFUNCTION        ˇˇˇˇˇˇˇˇˇˇˇRIGHTTEXT
  6284.  
  6285.        This function returns a specified number of characters from the
  6286.        end of a field or variable.
  6287.  
  6288.        Ex    Righttext(name,10)
  6289.  
  6290.  
  6291.        Ex.   Righttext(datetext(system date),4)
  6292.              < returns  1993 , 1994 Etc.>
  6293.  
  6294.  
  6295.        Acceptable parameters:
  6296.  
  6297.        Text field/variable
  6298.        Any function returning a text value
  6299.  
  6300.  
  6301.  
  6302.  
  6303.  
  6304.  
  6305.  
  6306.  
  6307.  
  6308.  
  6309.  
  6310.  
  6311.  
  6312.  
  6313.  
  6314.  
  6315.  
  6316.  
  6317.  
  6318.  
  6319.  
  6320.  
  6321.  
  6322.  
  6323.  
  6324.  
  6325.  
  6326.  
  6327.  
  6328.  
  6329.  
  6330.  
  6331.  
  6332.  
  6333.  
  6334.  
  6335.  
  6336.  
  6337.  
  6338.                                  - 108 -
  6339. ................................................................................
  6340.        ROUND                ˇˇˇˇˇˇFUNCTION        ˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇROUND
  6341.  
  6342.        There are three rounding functions in Easy base:-
  6343.  
  6344.        Round
  6345.        Roundup
  6346.        Rounddown
  6347.  
  6348.        If a rounding function is called with a single parameter then
  6349.        the return value is the parameter rounded to the nearest
  6350.        integer value.
  6351.  
  6352.        Ex. Round(items/reps)
  6353.           < if items = 9 and reps = 4. 2 is returned >
  6354.  
  6355.        All rounding functions accept a second parameter indicating the
  6356.        number of decimal places (or powers of 10 if negative) to round
  6357.        to.
  6358.  
  6359.        Ex. Rounddown(vaton(net),2)
  6360.           < Rounds down the VAT on field "net" to the nearest penny.
  6361.  
  6362.        Ex. Jointext(roundup(if(mod(years,100) = 0,years+1,years),-2
  6363.            )/100,"th Century")
  6364.  
  6365.          < Returns "20th Century" for all values of years 1900-1999 >
  6366.  
  6367.  
  6368.        Round Produces a default rounding system in which:-
  6369.  
  6370.           2.4 rounds to  2
  6371.           2.5 rounds to  3
  6372.          -2.4 rounds to -2
  6373.          -2.5 rounds to -3
  6374.  
  6375.        In the Roundup and Rounddown functions the direction is sign
  6376.        sensitive:-
  6377.  
  6378.           2.5 roundsup to  3      2.5 roundsdown to  2
  6379.          -2.5 roundsup to -2     -2.5 roundsdown to -3
  6380.  
  6381.        Acceptable parameters:
  6382.  
  6383.        Numeric value
  6384.        Numeric expression
  6385.        Numeric field/variable
  6386.        Any other function which returns a numeric value
  6387.  
  6388.  
  6389.  
  6390.  
  6391.  
  6392.  
  6393.  
  6394.  
  6395.                                  - 109 -
  6396. ................................................................................
  6397.        RUN                  ˇˇˇˇFIELD CONTROL     ˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇRUN
  6398.  
  6399.        The "run" control is used to initiate procedures with input
  6400.        screens without the user having to press F2.
  6401.  
  6402.        Ex.   If(lookup(customers,name) = blank,blank,lookup(customers,
  6403.              name)[run])
  6404.  
  6405.        In the above example, a procedure which lists customers
  6406.        accounts has an input screen with a single field where the
  6407.        customers name is entered. When the user enters a name the
  6408.        above derivation will test whether or not the entered name is a
  6409.        customer. If the entered name does not exist in the customers
  6410.        file the field will be blanked out but if it does then the
  6411.        procedure will run without the user having to press F2.
  6412.  
  6413.  
  6414.  
  6415.  
  6416.  
  6417.  
  6418.  
  6419.  
  6420.  
  6421.  
  6422.  
  6423.  
  6424.  
  6425.  
  6426.  
  6427.  
  6428.  
  6429.  
  6430.  
  6431.  
  6432.  
  6433.  
  6434.  
  6435.  
  6436.  
  6437.  
  6438.  
  6439.  
  6440.  
  6441.  
  6442.  
  6443.  
  6444.  
  6445.  
  6446.  
  6447.  
  6448.  
  6449.  
  6450.  
  6451.  
  6452.                                  - 110 -
  6453. ................................................................................
  6454.        SCREEN COLOURS       ˇˇˇˇˇˇUTILITY         ˇˇˇˇˇˇSCREEN COLOURS
  6455.  
  6456.        The "Screen Colours" utility provides 14 colour sets including
  6457.        two for "Mono Graphics" cards. To change the colours of your
  6458.        system simply select "Screen Colours" from the Utilities menu
  6459.        and select the set you want.
  6460.  
  6461.        The "Screen Colours" utility can also be called as a User Menu
  6462.        function allowing an end user to change his screen set from
  6463.        your menus without accessing the system.
  6464.  
  6465.  
  6466.  
  6467.  
  6468.  
  6469.  
  6470.  
  6471.  
  6472.  
  6473.  
  6474.  
  6475.  
  6476.  
  6477.  
  6478.  
  6479.  
  6480.  
  6481.  
  6482.  
  6483.  
  6484.  
  6485.  
  6486.  
  6487.  
  6488.  
  6489.  
  6490.  
  6491.  
  6492.  
  6493.  
  6494.  
  6495.  
  6496.  
  6497.  
  6498.  
  6499.  
  6500.  
  6501.  
  6502.  
  6503.  
  6504.  
  6505.  
  6506.  
  6507.  
  6508.  
  6509.                                  - 111 -
  6510. ................................................................................
  6511.        SECONDS              ˇˇˇˇˇˇFUNCTION        ˇˇˇˇˇˇˇˇˇˇˇˇˇSECONDS
  6512.  
  6513.        This function returns the seconds number from the time
  6514.        parameter.
  6515.  
  6516.        Ex.    seconds(system time)
  6517.  
  6518.  
  6519.        Acceptable parameters:
  6520.  
  6521.        System time
  6522.        Time field
  6523.        Maketime function
  6524.        Time expression
  6525.  
  6526.  
  6527.  
  6528.  
  6529.  
  6530.  
  6531.  
  6532.  
  6533.  
  6534.  
  6535.  
  6536.  
  6537.  
  6538.  
  6539.  
  6540.  
  6541.  
  6542.  
  6543.  
  6544.  
  6545.  
  6546.  
  6547.  
  6548.  
  6549.  
  6550.  
  6551.  
  6552.  
  6553.  
  6554.  
  6555.  
  6556.  
  6557.  
  6558.  
  6559.  
  6560.  
  6561.  
  6562.  
  6563.  
  6564.  
  6565.  
  6566.                                  - 112 -
  6567. ................................................................................
  6568.        SEQUENCE             ˇˇˇˇSYSTEM VALUE      ˇˇˇˇˇˇˇˇˇˇˇˇSEQUENCE
  6569.  
  6570.        When you create a new form a sequence value is updated each
  6571.        time a record is entered. The "sequence" value starts at 1 and
  6572.        continues to 2 billion irrespective of whether or not records
  6573.        have been deleted from the form. If you derive a field as
  6574.        "sequence" then each new record will have the next sequenced
  6575.        number. Sequence derivations are useful for such things as
  6576.        invoice numbers.
  6577.  
  6578.        A sequence field need not start at one however.
  6579.  
  6580.        Ex.  sequence + 1000 would number the first record 1001
  6581.  
  6582.        The sequence value is only available in data entry to a form.
  6583.        A common problem in data systems is to produce a sequence
  6584.        number when records are entered to forms via procedures.
  6585.  
  6586.        To accomplish this define fields to hold the number on both the
  6587.        form and the procedure input screen. Also define a single
  6588.        character text field, let's call it x on both. This field can
  6589.        be invisible. The x field in the form is indexed but not
  6590.        derived. The x field on the input screen is derived as "x".
  6591.        A relationship, let's call it "invoice" is entered between the
  6592.        input screen and the form relating the two "x" fields.
  6593.        Assuming the fields for the sequence number are called "invno"
  6594.        the field on the input screen is derived as:-
  6595.  
  6596.           lookup(invoice,invno)+ 1
  6597.  
  6598.        To update the x field in the form which is used purely as a
  6599.        flag to mark the last record your procedure code would be
  6600.        something like:-
  6601.  
  6602.        for invoices with x = "x"
  6603.           x = blank
  6604.           update record
  6605.        next
  6606.        for invoices new record
  6607.           copy all from input
  6608.        next
  6609.  
  6610.  
  6611.  
  6612.  
  6613.  
  6614.  
  6615.  
  6616.  
  6617.  
  6618.  
  6619.  
  6620.  
  6621.  
  6622.  
  6623.                                  - 113 -
  6624. ................................................................................
  6625.        SET PAPER LENGTH     ˇˇˇˇˇˇUTILITY         ˇˇˇˇSET PAPER LENGTH
  6626.  
  6627.        The "Set Paper Length" utility is accessed from the
  6628.        Utilities menu and can also be called from a user menu.
  6629.  
  6630.        There are settings for A3, A4, A5, American Letter and
  6631.        American Legal in both portrait and landscape.
  6632.  
  6633.        When you change the paper length in use then you update
  6634.        pagination for all report outputs.
  6635.  
  6636.        The landscape options are for use in wide carriage printers
  6637.        where the paper can be fed in landscape orientation they do not
  6638.        produce "sideways" printing on narrow carriage printers.
  6639.  
  6640.  
  6641.  
  6642.  
  6643.  
  6644.  
  6645.  
  6646.  
  6647.  
  6648.  
  6649.  
  6650.  
  6651.  
  6652.  
  6653.  
  6654.  
  6655.  
  6656.  
  6657.  
  6658.  
  6659.  
  6660.  
  6661.  
  6662.  
  6663.  
  6664.  
  6665.  
  6666.  
  6667.  
  6668.  
  6669.  
  6670.  
  6671.  
  6672.  
  6673.  
  6674.  
  6675.  
  6676.  
  6677.  
  6678.  
  6679.  
  6680.                                  - 114 -
  6681. ................................................................................
  6682.        SKIP GROUP           ˇˇPROCEDURE COMMAND   ˇˇˇˇˇˇˇˇˇˇSKIP GROUP
  6683.  
  6684.        The "Skip Group" command excludes an entire group of records
  6685.        from selection by a "For" loop.
  6686.  
  6687.        Ex.
  6688.  
  6689.        for employees with type in order
  6690.           if employees.type = "Part time" then skip group
  6691.           print list items
  6692.        next
  6693.  
  6694.        The "Skip Group" command is not the same as filtering with a
  6695.        "<>" condition.  You could achieve the same result with :-
  6696.  
  6697.        for employees with type in order
  6698.           if employees.type <> "Part time" then
  6699.              print list items
  6700.           end if
  6701.        next
  6702.  
  6703.        but the second procedure would take much longer to run as each
  6704.        part time employee's record would be loaded into memory only to
  6705.        be rejected by the "If" condition.  The first procedure on the
  6706.        other hand only loads a single part time employee's record then
  6707.        skips the entire group by advancing the index pointer in use
  6708.        for record selection.
  6709.  
  6710.        You can also use the "Skip Group" command to terminate
  6711.        selection of a group of records at a given point.
  6712.  
  6713.        declare variables
  6714.           count as number
  6715.        end
  6716.        for employees with type in order
  6717.           count = count + 1
  6718.           if count = 51 then
  6719.              count = 0
  6720.              skip group
  6721.           end if
  6722.           print list items
  6723.        next
  6724.  
  6725.        The above procedure prints the first fifty employees in each
  6726.        "type" group.
  6727.  
  6728.  
  6729.        The "Skip Group" command can be shortened to "Skipgrp"
  6730.  
  6731.  
  6732.  
  6733.  
  6734.  
  6735.  
  6736.  
  6737.                                  - 115 -
  6738. ................................................................................
  6739.        SKIP RECORD          ˇˇPROCEDURE COMMAND   ˇˇˇˇˇˇˇˇˇSKIP RECORD
  6740.  
  6741.        The "Skip Record" command is used to exclude individual records
  6742.        from selection in a "For" Loop.
  6743.  
  6744.        Ex.
  6745.  
  6746.        for employee with worksno in order
  6747.           if employees.worksno = 12 then skip record
  6748.           print list items
  6749.        next
  6750.  
  6751.        The "Skip Record" command has exactly the same effect as
  6752.        filtering with a "<>" condition but is much easier to write if
  6753.        there are many items to exclude
  6754.  
  6755.        for employees with worksno in order
  6756.           if employees.worksno = 12 or employees.worksno = 15 then
  6757.              skip record
  6758.           end if
  6759.           if employees.name = "smith" then skip record
  6760.           if employees.age > 50 then skip record
  6761.        next
  6762.  
  6763.        You can exclude groups of records from an inner loop by
  6764.        applying the "Skip Record" command to a "Unique" outer loop.
  6765.  
  6766.  
  6767.        for employees alias types with type in order unique
  6768.           if types.type = "director" then skip record
  6769.           if types.type = "part time" then skip record
  6770.           for employees with type = types.type
  6771.              print list items
  6772.           next
  6773.        next
  6774.  
  6775.  
  6776.        If you need to exclude groups of records from a single loop you
  6777.        must use the "Skip Group" command.
  6778.  
  6779.  
  6780.        The "Skip Record" command can be shortened to "Skiprec".
  6781.  
  6782.  
  6783.  
  6784.  
  6785.  
  6786.  
  6787.  
  6788.  
  6789.  
  6790.  
  6791.  
  6792.  
  6793.  
  6794.                                  - 116 -
  6795. ................................................................................
  6796.        SPACEPAD             ˇˇˇˇˇˇFUNCTION        ˇˇˇˇˇˇˇˇˇˇˇˇSPACEPAD
  6797.  
  6798.        The Spacepad function pads a text variable to a given length
  6799.        with spaces.
  6800.  
  6801.        Ex.   Spacepad(name,10)
  6802.              < returns "Fred      " if name = "Fred"
  6803.  
  6804.        The spacepad function is used in the creation of compound index
  6805.        fields.
  6806.  
  6807.        For example:    A "Films" form has the fields "title" and
  6808.        "category". To list the films grouped by category in order and
  6809.        with the titles in each category in order create the field
  6810.        "groupindex" as text,long enough to hold both category and
  6811.        title fields and derived as :-
  6812.  
  6813.        Jointext(spacepad(category,15),title)
  6814.                        {15 is length of category field}
  6815.  
  6816.        You can then produce the required printout with the following
  6817.  
  6818.        procedure.
  6819.  
  6820.        ....................format.........................
  6821.  
  6822.        .Report header
  6823.          ÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕ
  6824.                         FILM LIST BY CATEGORY
  6825.          ÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕ
  6826.        .Group header
  6827.          Films in {category field}
  6828.        .List items
  6829.         {title field} Starring {Star field} Running time {length Fld}
  6830.        .end
  6831.  
  6832.        ......................procedure code.................
  6833.        declare output fields
  6834.           films.title:films.star:films.length:films.category
  6835.        end
  6836.        declare variables
  6837.           catcheck as text
  6838.        end
  6839.        '............
  6840.        bold on
  6841.        print report header
  6842.        for films with groupindex in order
  6843.           if films.category <> catcheck then
  6844.              bold on
  6845.              print group header
  6846.              bold off
  6847.           end if
  6848.           print list items
  6849.        next
  6850.  
  6851.                                  - 117 -
  6852. ................................................................................
  6853.        SPELLDAY             ˇˇˇˇˇˇFUNCTION        ˇˇˇˇˇˇˇˇˇˇˇˇSPELLDAY
  6854.  
  6855.        This function spells out the day of the number (1-7) parameter.
  6856.  
  6857.        Ex.   Spellday(dayofweek(system date))
  6858.  
  6859.  
  6860.        Acceptable parameters:
  6861.  
  6862.        Numeric value                              (1-7)
  6863.        Numeric expression evaluating to           (1-7)
  6864.        Numeric Field/variable holding value       (1-7)
  6865.        Any function returning a numeric value     (1-7)
  6866.  
  6867.  
  6868.  
  6869.  
  6870.  
  6871.  
  6872.  
  6873.  
  6874.  
  6875.  
  6876.  
  6877.  
  6878.  
  6879.  
  6880.  
  6881.  
  6882.  
  6883.  
  6884.  
  6885.  
  6886.  
  6887.  
  6888.  
  6889.  
  6890.  
  6891.  
  6892.  
  6893.  
  6894.  
  6895.  
  6896.  
  6897.  
  6898.  
  6899.  
  6900.  
  6901.  
  6902.  
  6903.  
  6904.  
  6905.  
  6906.  
  6907.  
  6908.                                  - 118 -
  6909. ................................................................................
  6910.        SPELLMONTH           ˇˇˇˇˇˇFUNCTION        ˇˇˇˇˇˇˇˇˇˇSPELLMONTH
  6911.  
  6912.        This function spells out the day of the number (1-12)
  6913.        parameter.
  6914.  
  6915.  
  6916.        Ex.   Spellmonth(month(system date))
  6917.  
  6918.        Ex.   Month = Spellmonth(month(invoices.date))
  6919.  
  6920.  
  6921.        Acceptable parameters:
  6922.  
  6923.        Numeric value                           (1-12)
  6924.        Numeric expression evaluating to        (1-12)
  6925.        Numeric Field/variable holding value    (1-12)
  6926.        Any function returning a numeric value  (1-12)
  6927.  
  6928.  
  6929.  
  6930.  
  6931.  
  6932.  
  6933.  
  6934.  
  6935.  
  6936.  
  6937.  
  6938.  
  6939.  
  6940.  
  6941.  
  6942.  
  6943.  
  6944.  
  6945.  
  6946.  
  6947.  
  6948.  
  6949.  
  6950.  
  6951.  
  6952.  
  6953.  
  6954.  
  6955.  
  6956.  
  6957.  
  6958.  
  6959.  
  6960.  
  6961.  
  6962.  
  6963.  
  6964.  
  6965.                                  - 119 -
  6966. ................................................................................
  6967.        START HERE           ˇˇDERIVATION PREFIX   ˇˇˇˇˇˇˇˇˇˇSTART HERE
  6968.  
  6969.        If, in a form or procedure input screen, you want the cursor to
  6970.        start in other than the top left field then derive the field in
  6971.        which you wish the cursor to start with "Start here" .
  6972.  
  6973.        If the field in which the cursor is to start already has a
  6974.        derivation then simply prefix the derivation with "Start here".
  6975.  
  6976.        Ex.
  6977.  
  6978.        start here Lookup(customers,name)
  6979.  
  6980.  
  6981.  
  6982.        Note: You can only have one prefix on any one field derivation.
  6983.  
  6984.  
  6985.  
  6986.  
  6987.  
  6988.  
  6989.  
  6990.  
  6991.  
  6992.  
  6993.  
  6994.  
  6995.  
  6996.  
  6997.  
  6998.  
  6999.  
  7000.  
  7001.  
  7002.  
  7003.  
  7004.  
  7005.  
  7006.  
  7007.  
  7008.  
  7009.  
  7010.  
  7011.  
  7012.  
  7013.  
  7014.  
  7015.  
  7016.  
  7017.  
  7018.  
  7019.  
  7020.  
  7021.  
  7022.                                  - 120 -
  7023. ................................................................................
  7024.        STRINGOF             ˇˇˇˇˇˇFUNCTION        ˇˇˇˇˇˇˇˇˇˇˇˇSTRINGOF
  7025.  
  7026.        This function returns a string of characters.
  7027.  
  7028.        Ex.   Stringof(12,"-")
  7029.               < Returns "------------">
  7030.  
  7031.  
  7032.        Ex.  Stringof(5,chr$(240))
  7033.              < Returns "">
  7034.  
  7035.  
  7036.        One of the most useful applications of the "Stringof" function
  7037.        is to pad output fields in tabular reports with "." characters.
  7038.  
  7039.        Ex.
  7040.  
  7041.        Declare output fields
  7042.           stock.name : stock.price
  7043.        end
  7044.        for stock with name in order
  7045.           stock.name = jointext(stock.name,stringof(30-lengthtext(
  7046.                        stock.name),".")
  7047.           print list items
  7048.        next
  7049.  
  7050.  
  7051.        The printed output from the above report would be in the form:-
  7052.  
  7053.              Gizmo.........................  2.50
  7054.              Sprocket......................  9.95
  7055.              Widget........................  3.10
  7056.  
  7057.  
  7058.  
  7059.        Acceptable parameters:
  7060.  
  7061.        1   Any numeric field, variable, expression or function
  7062.        2   Single quoted character - Function returning a single
  7063.            character
  7064.  
  7065.  
  7066.  
  7067.  
  7068.  
  7069.  
  7070.  
  7071.  
  7072.  
  7073.  
  7074.  
  7075.  
  7076.  
  7077.  
  7078.  
  7079.                                  - 121 -
  7080. ................................................................................
  7081.        SUBINDEX             ˇˇPROCEDURE COMMAND   ˇˇˇˇˇˇˇˇˇˇˇˇSUBINDEX
  7082.  
  7083.        If you need to list records from a form in such a way that they
  7084.        are in groups but with each group in order, there are two ways
  7085.        to accomplish this. You can include a compound index field on
  7086.        the form or you can "subindex" the group during the procedure.
  7087.        The advantage of having a compound index is that no time is
  7088.        wasted "sorting" the sub group during any procedure that uses
  7089.        it and the disadvantage is that it uses extra disk space. As a
  7090.        general rule you should use a compound index where the sub
  7091.        groups are likely to be large and "subindex" during the
  7092.        procedure only if each sub group has up to a few dozen or so
  7093.        records or if you need to order unnatural groupings.
  7094.  
  7095.        Ex.
  7096.  
  7097.        for pupils alias agegroups with age in order unique
  7098.           for pupils alias sortgroup with age = agegroups.age
  7099.              subindex name
  7100.           next
  7101.           for pupils with subindex in order
  7102.              print list items
  7103.           next
  7104.        next
  7105.  
  7106.        The grouping can be extended to more than one level. The
  7107.        following example lists records from a "Videos" form grouped
  7108.        by rental price then by category and with the sub sub group
  7109.        titles in alphabetic order.
  7110.  
  7111.        for videos alias pricegroups with price in order unique
  7112.           for videos alias catgroups with category in order unique
  7113.              for videos alias group with category = catgroups.category
  7114.                 if group.price = pricegroups.price then
  7115.                    subindex title
  7116.                 end if
  7117.              next
  7118.              for videos with subindex in order
  7119.                 print list items
  7120.              next
  7121.           next
  7122.        next
  7123.  
  7124.        As you can see from the listing the output from these examples
  7125.        has to pause between groups while the subindex is written. If
  7126.        you have a 66 Mhz PC and there are twenty records in the sub
  7127.        group you probably won't notice but if you have a 12 Mhz
  7128.        machine and there are a thousand records in the sub group you
  7129.        may as well break for lunch!  If you write a "subindexing"
  7130.        procedure and find that the "Sorting" time is unacceptable then
  7131.        add a compound index field to the form.
  7132.  
  7133.  
  7134.  
  7135.  
  7136.                                  - 122 -
  7137. ................................................................................
  7138.        SUBINDEX             ˇˇPROCEDURE COMMAND   ˇˇˇˇˇˇˇˇˇˇˇˇSUBINDEX
  7139.  
  7140.        Although using compound index fields to produce group ordering
  7141.        is normally preferable to using "Subindex", there is one
  7142.        important area where "Subindex" is more flexible. That is where
  7143.        you need to order records in unnatural groups.
  7144.  
  7145.        Consider the "Videos" form which has fields for "Title" ,
  7146.        "RentalPrice" and "Category".
  7147.  
  7148.        Natural Groupings would be:-
  7149.  
  7150.        Titles with RentalPrice = ú2
  7151.        Titles with Category = "Comedy"
  7152.        Titles with RentalPrice = ú2 and category = "Horror"
  7153.  
  7154.        Unnatural groupings would be :-
  7155.  
  7156.        Titles with RentalPrice = ú2 or Rentalprice = ú1.50
  7157.        Titles With RentalPrice = ú1.50 or Category = "Western"
  7158.  
  7159.        Although you can make compound index fields to produce
  7160.        unnatural groupings they are not flexible - You need a separate
  7161.        compound index for each unnatural group.
  7162.  
  7163.        If you wished to write a procedure which allowed the user to
  7164.        enter any two video "Categories" and have all titles with
  7165.        either of those two categories listed in order then you must
  7166.        use "Subindex".
  7167.  
  7168.        Ex.
  7169.  
  7170.        for videos alias cat1 with category = input.cat1
  7171.           subindex title
  7172.        next
  7173.        for videos alias cat2 with category = input.cat2
  7174.           subindex title
  7175.        next
  7176.        for videos with subindex in order
  7177.           print list items
  7178.        next
  7179.  
  7180.        You will notice in the above example that two "For" loops add
  7181.        records to the "Subindex" before it is used. Once you start a
  7182.        subindex you can add records to it as often as you wish before
  7183.        using it. Once you use it it is erased.
  7184.  
  7185.        You can only have one "Subindex" active at any time. You can
  7186.        use any number of "Subindexes" within one procedure but each
  7187.        one must be "used" before the next is started.
  7188.  
  7189.  
  7190.  
  7191.  
  7192.  
  7193.                                  - 123 -
  7194. ................................................................................
  7195.        SYSTEM DATE          ˇˇˇˇSYSTEM VALUE      ˇˇˇˇˇˇˇˇˇSYSTEM DATE
  7196.  
  7197.        You can use your computers inbuilt date anywhere in field
  7198.        derivations or procedure code by simply quoting "system date".
  7199.  
  7200.        Ex.
  7201.  
  7202.        for diary with date = system date
  7203.           print list items
  7204.        next
  7205.  
  7206.  
  7207.  
  7208.  
  7209.  
  7210.  
  7211.  
  7212.  
  7213.  
  7214.  
  7215.  
  7216.  
  7217.  
  7218.  
  7219.  
  7220.  
  7221.  
  7222.  
  7223.  
  7224.  
  7225.  
  7226.  
  7227.  
  7228.  
  7229.  
  7230.  
  7231.  
  7232.  
  7233.  
  7234.  
  7235.  
  7236.  
  7237.  
  7238.  
  7239.  
  7240.  
  7241.  
  7242.  
  7243.  
  7244.  
  7245.  
  7246.  
  7247.  
  7248.  
  7249.  
  7250.                                  - 124 -
  7251. ................................................................................
  7252.        SYSTEM TIME          ˇˇˇˇSYSTEM VALUE      ˇˇˇˇˇˇˇˇˇSYSTEM TIME
  7253.  
  7254.        You can use your computers inbuilt time anywhere in field
  7255.        derivations or procedure code by simply quoting "system time".
  7256.  
  7257.        Ex.
  7258.  
  7259.        for stockitems with stockno = input.stockno
  7260.           lastcheckeddate = system date
  7261.           lastcheckedtime = system time
  7262.           update record
  7263.        next
  7264.  
  7265.  
  7266.  
  7267.  
  7268.  
  7269.  
  7270.  
  7271.  
  7272.  
  7273.  
  7274.  
  7275.  
  7276.  
  7277.  
  7278.  
  7279.  
  7280.  
  7281.  
  7282.  
  7283.  
  7284.  
  7285.  
  7286.  
  7287.  
  7288.  
  7289.  
  7290.  
  7291.  
  7292.  
  7293.  
  7294.  
  7295.  
  7296.  
  7297.  
  7298.  
  7299.  
  7300.  
  7301.  
  7302.  
  7303.  
  7304.  
  7305.  
  7306.  
  7307.                                  - 125 -
  7308. ................................................................................
  7309.        TABULATION           ˇˇˇˇˇˇˇMETHOD         ˇˇˇˇˇˇˇˇˇˇTABULATION
  7310.  
  7311.        To create a printout in which fields are enclosed within a
  7312.        lined table use the linedrawing facility in the format editor
  7313.        to create a page header and page footer containing the top and
  7314.        bottom of the table and insert only the vertical lines between
  7315.        the fields in the list items section.
  7316.  
  7317.        Ex.
  7318.  
  7319.        Declare output fields
  7320.           stock.name : stock.price
  7321.        end
  7322.        print page header
  7323.        for stock with name in order
  7324.           if bottom margin < 0.7 then
  7325.              print page footer
  7326.              page feed
  7327.              print page header
  7328.           end if
  7329.           print list items
  7330.        next
  7331.        print page footer
  7332.        Page feed
  7333.  
  7334.        ........................format.........................
  7335.  
  7336.        .page header
  7337.              …ÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕ—ÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕª
  7338.              ∫ Name               ≥  Price        ∫
  7339.              ÃÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÿÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕπ
  7340.        .list items
  7341.              ∫ {Name Field     }  ≥ {Price Fld. } ∫
  7342.        .page footer
  7343.              »ÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕœÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕº
  7344.        .end
  7345.  
  7346.  
  7347.  
  7348.  
  7349.  
  7350.  
  7351.  
  7352.  
  7353.  
  7354.  
  7355.  
  7356.  
  7357.  
  7358.  
  7359.  
  7360.  
  7361.  
  7362.  
  7363.  
  7364.                                  - 126 -
  7365. ................................................................................
  7366.        TEXT                 ˇˇˇˇˇFIELD TYPE       ˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇTEXT
  7367.  
  7368.        The text field type can be up to 80 characters long.
  7369.  
  7370.        Cut copy and paste operations are available between all text,
  7371.        and textblock fields :
  7372.  
  7373.        Use Shift plus the arrow keys to mark the text you wish to cut
  7374.        or copy. When you release the keys the cut or copy choice will
  7375.        appear.
  7376.  
  7377.        To paste cut text position the cursor where you want it
  7378.        inserted and press Shift plus Ins.
  7379.  
  7380.        Spell Checking is also available in text fields -
  7381.           Press Ctrl + S
  7382.  
  7383.  
  7384.  
  7385.  
  7386.  
  7387.  
  7388.  
  7389.  
  7390.  
  7391.  
  7392.  
  7393.  
  7394.  
  7395.  
  7396.  
  7397.  
  7398.  
  7399.  
  7400.  
  7401.  
  7402.  
  7403.  
  7404.  
  7405.  
  7406.  
  7407.  
  7408.  
  7409.  
  7410.  
  7411.  
  7412.  
  7413.  
  7414.  
  7415.  
  7416.  
  7417.  
  7418.  
  7419.  
  7420.  
  7421.                                  - 127 -
  7422. ................................................................................
  7423.        TEXT BLOCK           ˇˇˇˇˇFIELD TYPE       ˇˇˇˇˇˇˇˇˇˇTEXT BLOCK
  7424.  
  7425.        When you Define a field with the field type "Text Block" then
  7426.        instead of entering a field length you shade out the area which
  7427.        you wish the field to cover using the arrow keys.
  7428.  
  7429.        Textblock fields offer many of the facilities of a
  7430.        wordprocessor including cut and paste, wordwrap and spell
  7431.        checking.
  7432.  
  7433.        Useful widths for A4 and Letter size paper are 63 characters if
  7434.        you intend to print at 10 characters per inch and 75 characters
  7435.        if you intend to print at 12 characters per inch. This document
  7436.        for instance was created in 63 character wide text blocks.
  7437.  
  7438.        The maximum width of a text block field on screen is 80
  7439.        characters. You can however redefine it up to 230 characters
  7440.        wide in procedure printouts and Easy Base will reformat your
  7441.        paragraphs to the new width.
  7442.  
  7443.        A text block field is not a "memo" field. It can be indexed and
  7444.        derived.
  7445.  
  7446.  
  7447.  
  7448.  
  7449.  
  7450.  
  7451.  
  7452.  
  7453.  
  7454.  
  7455.  
  7456.  
  7457.  
  7458.  
  7459.  
  7460.  
  7461.  
  7462.  
  7463.  
  7464.  
  7465.  
  7466.  
  7467.  
  7468.  
  7469.  
  7470.  
  7471.  
  7472.  
  7473.  
  7474.  
  7475.  
  7476.  
  7477.  
  7478.                                  - 128 -
  7479. ................................................................................
  7480.        TIME                 ˇˇˇˇˇFIELD TYPE       ˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇTIME
  7481.  
  7482.        The Easy Base "time" field has the eight character format:-
  7483.  
  7484.        11:20:20    (Hours:Minutes:Seconds)
  7485.  
  7486.        You can record time data in any format you wish by using a
  7487.        "Formatted Text" field but you must use a "Time" field if you
  7488.        wish to perform addition and subtraction operations on time
  7489.        values.  (in seconds)
  7490.  
  7491.        Time fields are automatically checked for validity.
  7492.  
  7493.  
  7494.        See Also:-  Maketime
  7495.  
  7496.  
  7497.  
  7498.  
  7499.  
  7500.  
  7501.  
  7502.  
  7503.  
  7504.  
  7505.  
  7506.  
  7507.  
  7508.  
  7509.  
  7510.  
  7511.  
  7512.  
  7513.  
  7514.  
  7515.  
  7516.  
  7517.  
  7518.  
  7519.  
  7520.  
  7521.  
  7522.  
  7523.  
  7524.  
  7525.  
  7526.  
  7527.  
  7528.  
  7529.  
  7530.  
  7531.  
  7532.  
  7533.  
  7534.  
  7535.                                  - 129 -
  7536. ................................................................................
  7537.        TIMEAMPM             ˇˇˇˇˇˇFUNCTION        ˇˇˇˇˇˇˇˇˇˇˇˇTIMEAMPM
  7538.  
  7539.        This function returns the hour ( 0 - 12) plus am. or pm. from
  7540.        the time field parameter.
  7541.  
  7542.        Ex. Timeampm(system time)
  7543.  
  7544.        Ex.
  7545.        -------------------------format----------------------------
  7546.        .Report header
  7547.                       Appointments for {Apps.Date Field}
  7548.        .List items
  7549.                  {Apps.Name Field      }   at  {Time Field}
  7550.        .End
  7551.        -------------------------code----------------------------
  7552.        declare output fields
  7553.           Apps.name
  7554.           Apps.date
  7555.           Time
  7556.        end
  7557.        print report header
  7558.        for apps with date = system date
  7559.           time = timeampm(apps.time)
  7560.           print list items
  7561.        next
  7562.  
  7563.  
  7564.        Acceptable parameters:
  7565.  
  7566.        System time
  7567.        Time field
  7568.        Maketime function
  7569.        Time expression
  7570.  
  7571.  
  7572.  
  7573.  
  7574.  
  7575.  
  7576.  
  7577.  
  7578.  
  7579.  
  7580.  
  7581.  
  7582.  
  7583.  
  7584.  
  7585.  
  7586.  
  7587.  
  7588.  
  7589.  
  7590.  
  7591.  
  7592.                                  - 130 -
  7593. ................................................................................
  7594.        TOTAL COPIES         ˇˇˇˇSYSTEM VALUE      ˇˇˇˇˇˇˇˇTOTAL COPIES
  7595.  
  7596.        Whenever a procedure enters a "FOR" loop qualified by "With
  7597.        fieldname = " the total number of records which match the
  7598.        qualification value is available in the system value "Total
  7599.        Copies"
  7600.  
  7601.        Total Copies is extracted directly from the index file and
  7602.        relieves you of a time consuming loop all the way through a
  7603.        form updating a counter.
  7604.  
  7605.        In other words:-
  7606.  
  7607.        for books with category = "fiction"
  7608.           count = count + 1
  7609.        next
  7610.  
  7611.        can be replaced with:-
  7612.  
  7613.        for books with category = "fiction"
  7614.           count = total copies
  7615.           exit for
  7616.        next
  7617.  
  7618.        Unlike "Total Records" the "Total Copies" value never includes
  7619.        records marked for deletion.
  7620.  
  7621.        Easy Base does not track separate values for "Total Records" or
  7622.        "Total Copies" when there are nested "For" loops. The values
  7623.        are set for the outer loop on the first iteration and reset for
  7624.        the inner loop on its first iteration. If you need a value for
  7625.        "Total Records" or for "Total Copies" after your procedure has
  7626.        entered another loop then you must transfer the value to a
  7627.        variable while it is available. (See the example for "Display
  7628.        Status")
  7629.  
  7630.        Easy Base does not update "Total Records" or "Total Copies"
  7631.        when records are added or deleted during a procedure.
  7632.  
  7633.  
  7634.  
  7635.  
  7636.  
  7637.  
  7638.  
  7639.  
  7640.  
  7641.  
  7642.  
  7643.  
  7644.  
  7645.  
  7646.  
  7647.  
  7648.  
  7649.                                  - 131 -
  7650. ................................................................................
  7651.        TOTAL RECORDS        ˇˇˇˇSYSTEM VALUE      ˇˇˇˇˇˇˇTOTAL RECORDS
  7652.  
  7653.        Whenever a procedure enters a "FOR" loop the total number of
  7654.        records in the form is available in the system value "Total
  7655.        records"
  7656.  
  7657.        Ex.
  7658.        The following code fragment updates a "Customer summary" form
  7659.        with the total number of customers in the "Customers" form.
  7660.  
  7661.        declare variables
  7662.          tot as number
  7663.        end
  7664.        for customers with acno = 1
  7665.           tot = total records
  7666.           exit for
  7667.        next
  7668.        for customersummary
  7669.           customersummary.totalcustomers = tot
  7670.           update record
  7671.        next
  7672.  
  7673.        Caution.
  7674.  
  7675.        Provided that the "For" loop is qualified by a "with" statement
  7676.        then the "Total Records" value is extracted directly from the
  7677.        open index file and is the total number of "Live Records".
  7678.  
  7679.        If you access the "Total records" value in an unqualified "For"
  7680.        loop then there is no index file open and the "Total Records"
  7681.        value is derived by dividing the forms file length by the
  7682.        record length. It therefore represents the total number of
  7683.        records in the form "Live" and "Deleted".
  7684.  
  7685.        Ex.
  7686.  
  7687.        If a form "books" has 2000 records and 10 are marked for
  7688.        deletion at the next re-pack then "count" returns 1990 in:-
  7689.  
  7690.        for books with catalogueno = 1
  7691.          count = total records
  7692.        next
  7693.  
  7694.        and 2000 in :-
  7695.  
  7696.        for books
  7697.           count = total records
  7698.           exit for
  7699.        next
  7700.  
  7701.  
  7702.  
  7703.  
  7704.  
  7705.  
  7706.                                  - 132 -
  7707. ................................................................................
  7708.        UPDATE RECORD        ˇˇPROCEDURE COMMAND   ˇˇˇˇˇˇˇUPDATE RECORD
  7709.  
  7710.        The "Update record" command is used to alter the contents of
  7711.        one or many records in a form.
  7712.  
  7713.        Ex.
  7714.  
  7715.        for stock with item = input.item
  7716.           stock.price = input.price
  7717.           stock.pricechangedate = system date
  7718.           update record
  7719.        next
  7720.  
  7721.        This example changes the price of a single "Stock" item.
  7722.  
  7723.  
  7724.        for employees with taxcode = input.oldtaxcode
  7725.           employees.taxcode = input.newtaxcode
  7726.           update record
  7727.        next
  7728.  
  7729.        This example changes the taxcode field of all the employees
  7730.        whose present taxcode is the same as the input screen
  7731.        "oldtaxcode" to the input screen "newtaxcode".
  7732.  
  7733.  
  7734.        for employees
  7735.           employees.taxcode = employees.taxcode + 60
  7736.           update record
  7737.        next
  7738.  
  7739.        This example increases the taxcode of all employees by sixty.
  7740.  
  7741.  
  7742.  
  7743.  
  7744.  
  7745.  
  7746.  
  7747.  
  7748.  
  7749.  
  7750.  
  7751.  
  7752.  
  7753.  
  7754.  
  7755.  
  7756.  
  7757.  
  7758.  
  7759.  
  7760.  
  7761.  
  7762.  
  7763.                                  - 133 -
  7764. ................................................................................
  7765.        UPPER                ˇˇˇˇˇˇFUNCTION        ˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇUPPER
  7766.  
  7767.        Returns the Uppercase of a text field or variable.
  7768.  
  7769.        Ex.  Upper(postcode)
  7770.             < shows the postcode field in uppercase>
  7771.  
  7772.        Ex.
  7773.        '.......................
  7774.        declare output fields
  7775.           labelname
  7776.           labeladdress
  7777.           labelcode
  7778.        end
  7779.        for customers with maillist = "yes"
  7780.           Labelname = Upper(customers.name)
  7781.           Labeladdress = Upper(customers.address)
  7782.           Labelcode = customers.postcode
  7783.           print labels
  7784.        next
  7785.  
  7786.        Acceptable parameters:
  7787.  
  7788.        Quoted text
  7789.        Text field/variable
  7790.  
  7791.  
  7792.  
  7793.  
  7794.  
  7795.  
  7796.  
  7797.  
  7798.  
  7799.  
  7800.  
  7801.  
  7802.  
  7803.  
  7804.  
  7805.  
  7806.  
  7807.  
  7808.  
  7809.  
  7810.  
  7811.  
  7812.  
  7813.  
  7814.  
  7815.  
  7816.  
  7817.  
  7818.  
  7819.  
  7820.                                  - 134 -
  7821. ................................................................................
  7822.        V.A.T. FUNCTIONS     ˇˇˇˇˇˇFUNCTION        ˇˇˇˇV.A.T. FUNCTIONS
  7823.  
  7824.        Easy Base has a set of five VAT rates which can be altered from
  7825.        the utilities menu. There are four VAT functions:-
  7826.           VATin
  7827.           VATon
  7828.           PlusVAT
  7829.           MinusVAT
  7830.  
  7831.        Ex.   VATin(retailprice,2)
  7832.               < Returns the VAT content of "retailprice" at VAT rate 2
  7833.  
  7834.        Ex.   VATon(netprice,4)
  7835.              < Returns the VAT to be added to "netprice" at VAT rate 4
  7836.  
  7837.        Ex.   PlusVAT(netprice,3)
  7838.              < Returns the VAT inclusive price at VAT rate 3>
  7839.  
  7840.        Ex.   MinusVAT(retailprice,2)
  7841.              < Returns the net price of "retailprice" before VAT at
  7842.                VAT rate 2>
  7843.  
  7844.         (assumes Retailprice as VAT Inclusive and Netprice exclusive)
  7845.  
  7846.        If the second parameter (rate) is omitted from any of the VAT
  7847.        functions then Rate 1 is assumed.
  7848.  
  7849.        Ex.   Gross = PlusVAT(input.net)
  7850.              < The variable "Gross" = the VAT inclusive of the input
  7851.               screen field "net" calculated at rate 1.>
  7852.  
  7853.        Although the VAT functions are primarily included for business
  7854.        applications, they can be used for any purpose where a
  7855.        percentage needs to be changed globally throughout an
  7856.        application without the need to alter each procedure or field
  7857.        derivation in which it is used.
  7858.  
  7859.        Acceptable parameters:
  7860.  
  7861.        1   Any numeric value, field, variable, expression or function
  7862.        2   As Parameter 1 but evaluating between 1 an 5
  7863.  
  7864.  
  7865.  
  7866.  
  7867.  
  7868.  
  7869.  
  7870.  
  7871.  
  7872.  
  7873.  
  7874.  
  7875.  
  7876.  
  7877.                                  - 135 -
  7878. ................................................................................
  7879.        YEAR                 ˇˇˇˇˇˇFUNCTION        ˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇYEAR
  7880.  
  7881.        This function returns the year number from a date parameter.
  7882.  
  7883.        Ex.    Year(system date)
  7884.  
  7885.        Ex.
  7886.  
  7887.        Carage = jointext((year(system date)-year(registered))," Years
  7888.        old")
  7889.  
  7890.  
  7891.        Acceptable parameters:
  7892.  
  7893.        System date
  7894.        Date field
  7895.        Makedate function
  7896.        Date expression
  7897.  
  7898.  
  7899.  
  7900.  
  7901.  
  7902.  
  7903.  
  7904.  
  7905.  
  7906.  
  7907.  
  7908.  
  7909.  
  7910.  
  7911.  
  7912.  
  7913.  
  7914.  
  7915.  
  7916.  
  7917.  
  7918.  
  7919.  
  7920.  
  7921.  
  7922.  
  7923.  
  7924.  
  7925.  
  7926.  
  7927.  
  7928.  
  7929.  
  7930.  
  7931.  
  7932.  
  7933.  
  7934.                                  - 136 -
  7935. ................................................................................
  7936.        ZEROPAD              ˇˇˇˇˇˇFUNCTION        ˇˇˇˇˇˇˇˇˇˇˇˇˇZEROPAD
  7937.  
  7938.        The Zeropad function pads an integer or fixed point field to a
  7939.        given number of places left and right of the decimal point.
  7940.  
  7941.        Ex.  Zeropad(price,3,2)
  7942.             <Returns "001.50" if price = 1.5>
  7943.  
  7944.        Ex.  Zeropad(acno,6,0)
  7945.             <Returns "004532" if acno = 4,532>
  7946.  
  7947.        The Zeropad function can be used as in the second example to
  7948.        return a fixed length numeric string from an integer field.
  7949.        It's main use, however, is in the creation of fields for
  7950.        compound indices where one of the fields to be compounded is a
  7951.        number.
  7952.  
  7953.        For example: A school has all pupils names and ages recorded on
  7954.        a form in fields "name" and "age". To create an index which
  7955.        will list pupils names alphabetically but grouped by age a
  7956.        compound field which is invisible and does not allow user entry
  7957.        is created as a text field derived with:-
  7958.        Jointext(zeropad(age,2,0),name)
  7959.  
  7960.        Because the compound field is text the index file will be
  7961.        sorted alphabetically. If you sort the numbers 8,9 and 12
  7962.        alphabetically you get 12,8,9 because the one in 12 comes
  7963.        before 8. If however you sort the numbers 08,09 and 12
  7964.        alphabetically you get the correct numeric order.
  7965.  
  7966.        By using the zeropad function in the above example and indexing
  7967.        the compound field,let's call it "unifield" you could then
  7968.        print out the pupils in age groups with the names in each group
  7969.        arranged alphabetically.
  7970.        .........................format.................
  7971.        .group header
  7972.         Pupils aged {pupils.age field}
  7973.        .list items
  7974.                {pupils.name field}
  7975.        .end
  7976.        .........................procedure code.........
  7977.        declare output fields
  7978.           pupils.name:pupils.age
  7979.        end
  7980.        declare variables
  7981.           agecheck as number
  7982.        end
  7983.        agecheck = 0
  7984.        for pupils with unifield in order
  7985.           if pupils.age <> agecheck then print group header
  7986.           agecheck = pupils.age
  7987.           print list items
  7988.        next
  7989.  
  7990.  
  7991.                                  - 137 -
  7992. ................................................................................
  7993.